Reputation: 3095
I'm adding an apple watch extension to my project and I'd like to use the same pods I'm using for my main iOS app. However, the podspec I'm using for my iOS app has a dependency that causes an error when I include the watch extension as a target in my podfile. Is there a way to remove dependencies based on platform (ios, watchos)?
The error:
[!] The platform of the target `My Watch Extension` (watchOS 5.2) is not compatible with `Library X (10.1.19)`, which does not support `watchos`.
So far I'm doing the following in my podfile:
target 'My Watch Extension' do
platform :watchos, '5.2'
pod 'MyPod', :path => 'MyPod'
end
And I added the following to my podspec:
s.platforms = { :ios => "10.0", :watchos => "5.2"}
Is it possible to have to separate podspecs?
Upvotes: 1
Views: 761
Reputation: 1320
You can set different dependencies for different platforms
spec.dependency 'Alamofire'
spec.ios.dependency 'Crashlytics'
Upvotes: 1
Reputation: 11083
Here is a simplified version of my podfile. I just include different pod's for the different targets.
def external_dependencies
pod 'Alamofire'
pod 'SQLite.swift/SQLCipher'
end
def caller_id_external_dependencies
pod 'GMCPagingScrollView'
pod 'KeychainAccess'
end
target 'Goob' do
external_dependencies
internal_dependencies
target 'UnitTests' do
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'SQLite.swift/SQLCipher'
inherit! :search_paths
end
end
target 'GoobCallerId' do
caller_id_external_dependencies
end
Upvotes: 0