gpt4 book ai didi

ios - Watchkit 扩展中的 SwiftyJSON 不起作用

转载 作者:行者123 更新时间:2023-11-28 19:41:21 26 4
gpt4 key购买 nike

在 XCode-7.2 下使用 iOS-9.2、watchOS-2.1、Swift-2.1.1:

尝试在我的 Watchkit 扩展中使用 SwiftyJSON (v2.3.2)! SwiftyJSON 的安装是通过以下 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”)

enter image description here

此外,在上述错误旁边,我收到以下警告:

enter image description here

有人可以帮忙吗??感谢任何支持!!

附言当我将 SwiftyJSON 导入任何 iOS 目标的 ViewControllers 时,也会出现相同的错误和警告...

最佳答案

我设法通过以下方式修复它:- 更新 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
  • 最后,通过单击窗口 -> 项目 -> “选择您的项目”并删除派生数据来清除项目数据

关于ios - Watchkit 扩展中的 SwiftyJSON 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34181217/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com