watchOS 2 working with CocoaPods

╄→尐↘猪︶ㄣ 提交于 2019-12-05 18:30:19

CocoaPods currently doesn't support watchos. There is a work in progress issue here for adding support for it.

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

According to the blog above, deployment target can be set to watchOS 2 in Podspec.

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

You can set target for watchOS 2 in Podfile with the version.
However, library has to set the deployment target explicitly, so you need to check whether it's supported for each library in Podspec.

Senseful

The latest version of CocoaPods supports this.

If you just need to get a pod working on watchOS 2 (e.g. Parse), the you can simply use a Podfile such as this:

# 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 pod in multiple targets of different platforms (e.g. iOS and watchOS 2), things are slightly tricker. See this answer for more information.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!