WatchOS 2 works with CocoaPods

Has anyone got CocoaPods working with watchOS 2? I tried using 'use_framework! with "platform: watchos", 2.0, but it says "[!] Invalid Podfile

file: Unsupported platform watchos2

. Platform must be :ios

or :osx

.. Updating CocoaPods may fix the problem."

I am using the latest version of CocoaPods.

+3


source to share


3 answers


CocoaPods does not currently support watchos. Here's a job added to add support for it.



0


source


CocoaPods has released a new version which is 0.38.0 and now supports watchOS 2.
http://blog.cocoapods.org/CocoaPods-0.38/

According to the blog above, the deployment target can be installed on watchOS 2 in Podspec

.



Pod::Spec.new do |s|
# …
s.watchos.deployment_target = '2.0'
end

      

You can set a target for watchOS 2 Podfile

using the.
However, the library needs to set the deployment target explicitly , so you need to check if it is supported for each library in Podspec

.

+5


source


The latest version of CocoaPods supports this.

If you just need to get a pod working on watchOS 2 (like Parse), you can just use a subfile like:

# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
# use_frameworks!

target 'MyApp' do

end

target 'MyApp WatchKit App' do

end

target 'MyApp WatchKit Extension' do
    platform :watchos, '2.0'
    pod 'Parse', '~> 1.11'
end

      

If, however, you need to use the module for multiple purposes across platforms (like iOS and watchOS 2), things are a little more complicated. See this answer for details .

+1


source







All Articles