Cocoapods: Possible to connect single Pod to multiple targets with different min deployment target?

Created on 22 Jul 2020  路  7Comments  路  Source: CocoaPods/CocoaPods

I couldn't find anything related to this question. That's why I am posting it here.

Recently, we did increase our app's min deployment target iOS 9.0 > 11.0. However, our app uses additional internal frameworks that are still pointing to iOS 9. Is it possible to share the same Pod with two targets that they do have different minimum deployment target?

So far I tried.

workspace 'ABC.xcworkspace'
platform :ios, '11.0'
use_frameworks! :linkage => :static

# ============= SCOPES ============= #
def firebase
    pod 'Firebase/Core'
    pod 'Firebase/Messaging'
    pod 'Firebase/DynamicLinks'
    pod 'Firebase/InAppMessaging'
end

# ============= TARGETS ============ #
target 'ABC' do
    firebase
end

target :Core do
    platform :ios, '9.0'
    firebase
end

_Note: This is not the exact Podfile but rather a sample of it._

But this generates duplicate Targets under Pods.xcodeproj appending -iOS9.0 and -iOS11.0.

What is the right way achieving what I am looking for? If currently possible.

help wanted

Most helpful comment

i'll need time to take the sample podfile and dig through into the issue.

All 7 comments

Hmmm I would have to check if this is possible. If you embed :Core into ABC does this work or does it produce the same results?

@dnkoutso Unfortunately is the same outcome. Compiles fine but when you try archive:

Showing All Errors Only
Multiple commands produce '.../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/SDWebImage.framework':
1) Target 'SDWebImage-iOS11.0' has create directory command with output '.../Build/Intermediates.noindex/ArchiveIntermediates/.../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/SDWebImage.framework'
2) Target 'SDWebImage-iOS9.0' has create directory command with output '.../Build/Intermediates.noindex/ArchiveIntermediates/.../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/SDWebImage.framework'

_Note: SDWebImage is just another Pod we do share between the two targets (In addition to Firebase)_

Let me clarify that initially, we had platform :ios, '9.0' defined at the very top. After increasing minimum deployment target to iOS 11.0 for our app, we did change Podfile as well (as you see above). However, while this is building and running with no issues on Xcode when we try to archive for distribution, console produces

ld: framework not found Pods_Core

@p-nicolaou just catching up with most issues of CocoaPods... I wonder if this is an "issue" with the new build system and us trying to be smart by having two separate targets that produce the same framework name but the targets are named differently...

i'll need time to take the sample podfile and dig through into the issue.

@dnkoutso I also encountered this problem

My Podfile

install! "cocoapods",
         :generate_multiple_pod_projects => true,
         :incremental_installation => true

use_frameworks!

target "test" do
  platform :ios, "10.0"

  pod "SDWebImage"
end

target "test2" do
  platform :ios, "9.0"

  pod "SDWebImage"
end

Error

Multiple commands produce '.../Library/Developer/Xcode/DerivedData/test-dwskvvaamiaelwhcbotydijxebwv/Build/Intermediates.noindex/ArchiveIntermediates/test2/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/SDWebImage.framework':
1) Target 'SDWebImage-iOS10.0' has create directory command with output '.../Library/Developer/Xcode/DerivedData/test-dwskvvaamiaelwhcbotydijxebwv/Build/Intermediates.noindex/ArchiveIntermediates/test2/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/SDWebImage.framework'
2) Target 'SDWebImage-iOS9.0' has create directory command with output '.../Library/Developer/Xcode/DerivedData/test-dwskvvaamiaelwhcbotydijxebwv/Build/Intermediates.noindex/ArchiveIntermediates/test2/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/SDWebImage.framework'

happens when archiving test2.

It may be related to 驶use_frameworks!`, because I can archive it after deleting it

Was this page helpful?
0 / 5 - 0 ratings