[英]SwiftyJSON in Watchkit Extension not working
使用iOS-9.2,watchOS-2.1,XCode-7.2下的Swift-2.1.1:
尝试在我的Watchkit Extension中使用SwiftyJSON(v2.3.2)! SwiftyJSON的安装由以下Podfile完成:
Podfile:
xcodeproj 'TableTestKOS001.xcodeproj'
workspace 'TableTestKOS001.xcworkspace'
platform :ios, '9.0'
inhibit_all_warnings!
use_frameworks!
link_with 'TableTestKOS001', 'TableTestKOS001 WatchKit Extension'
def shared_pods
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
end
target 'TableTestKOS001' do
shared_pods
end
target 'TableTestKOS001Tests' do
shared_pods
end
target 'TableTestKOS001 WatchKit Extension' do
platform :ios, '9.0'
shared_pods
end
使用“ pod install”,我得到:
Updating local specs repositories
Analyzing dependencies
Pre-downloading: `SwiftyJSON` from `https://github.com/SwiftyJSON/SwiftyJSON.git`
Downloading dependencies
Installing SwiftyJSON (2.3.2)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `TableTestKOS001.xcworkspace` for this project from now on.
Sending stats
Sending stats
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total
pod installed.
这告诉我,到目前为止一切都还好!
之后,我打开项目(不使用.proj文件),而是使用新创建的工作区文件(即我的TableTestKOS001.xcworkspace)。
现在问题开始了:
一旦我将“ SwiftyJSON”“导入”我的WatchKit-Extension的WKInterfaceControllers中,我就会收到以下错误(即“没有这样的模块SwiftyJSON”)
而且,在上述错误旁边,我收到以下警告:
有人可以帮忙吗? 任何支持表示赞赏!
PS当我将SwiftyJSON导入任何iOS目标的ViewController时,也会发生相同的错误和警告...
我设法通过以下方法解决此问题:-更新cocoapods,然后修改Podfile
以指定平台
target 'My App' do
pod 'Google/Analytics'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
end
target 'My App Watch Extension' do
platform :watchos, '2.0'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
end
pod install
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.