Objective C Xcode 中的项目 7 CocoaPods 错误
Objective C Project in Xcode 7 CocoaPods Error
我在 运行 pod install
之后收到的 终端错误 是:
我意识到 ReactiveCocoa
的 cocoapod 完全在 SWIFT 中,我需要 桥接 头文件,但我的尝试已经很远了来自成功。
我确实找到了来自 TeamTreehouse 的一位员工的 this 回复:
"The SimpleAuth library has it's own set of dependencies one of which is ReactiveCocoa. ReactiveCocoa was recently rewritten completely in Swift so that's the Swift code that's getting added to your project. Unfortunately there are 2 versions of ReactiveCocoa out there, written in Swift 1.2 and Swift 2.0.
SimpleAuth is currently automatically pulling the 1.2 version of ReactiveCocoa.
Swift 1.2 can only be run in Xcode 6.1 and not in Xcode 7 (which requires Swift 2).
So if you are using Xcode 7, then you're pulling in the Swift 1.2 version by default and this is causing all the Swift errors.
Also, you have to do some cleanup work to get Swift frameworks to run in a mixed Objective-C/Swift project which includes adding a bridging header and stuff."
.
^^ 解释了我的问题^^
提前致谢!
编辑
将 use_frameworks!
添加到我的 Podfile 后,我收到如下错误:
错误消息说要将行 use_frameworks!
添加到名为 Podfile
的文件中。
将它添加到第一行下面,可能应该是 platform :ios, 'x.0'
。
您需要使用 ReactiveCocoa 4.0,目标是 Swift 2.0,但仍处于 alpha 版本。
如果您想尝试一下,请查看此内容。
use_frameworks!
target 'YOUR_TARGET' do
pod 'ReactiveCocoa', '~> 4.0.0-alpha'
end
在我的 pod 文件中尝试 use_frameworks!
之后,由于 ReactiveCocoa
和 .swift
文件,我仍然遇到错误(即使在自动更正 Xcode 试图为我修复)。
在我的 Podfile
中,我能够解决我遇到的两组错误:
1. 当在 Podfile 中包含 use_frameworks!
2. 另外当 运行 我原来的 pod install
希望添加 Parse cocoapod
Podfile 中的最终代码
pod 'ReactiveCocoa', '2.4.7'
pod 'SimpleAuth/Instagram', '0.3.6'
pod 'SSKeychain'
pod 'Parse'
您实际上可以请求最新版本的依赖项。您的 Podfile 应如下所示:
platform :ios, "9.0"
use_frameworks!
target 'MyAppNameHere' do
end
pod 'Box', :head
pod 'Result', :head
pod 'SimpleAuth/Instagram'
然后执行 pod update
并在您的项目中,Product > Clean
和 Product > Build
将再次工作。
我在 运行 pod install
之后收到的 终端错误 是:
我意识到 ReactiveCocoa
的 cocoapod 完全在 SWIFT 中,我需要 桥接 头文件,但我的尝试已经很远了来自成功。
我确实找到了来自 TeamTreehouse 的一位员工的 this 回复:
"The SimpleAuth library has it's own set of dependencies one of which is ReactiveCocoa. ReactiveCocoa was recently rewritten completely in Swift so that's the Swift code that's getting added to your project. Unfortunately there are 2 versions of ReactiveCocoa out there, written in Swift 1.2 and Swift 2.0.
SimpleAuth is currently automatically pulling the 1.2 version of ReactiveCocoa.
Swift 1.2 can only be run in Xcode 6.1 and not in Xcode 7 (which requires Swift 2).
So if you are using Xcode 7, then you're pulling in the Swift 1.2 version by default and this is causing all the Swift errors.
Also, you have to do some cleanup work to get Swift frameworks to run in a mixed Objective-C/Swift project which includes adding a bridging header and stuff."
.
^^ 解释了我的问题^^
提前致谢!
编辑
将 use_frameworks!
添加到我的 Podfile 后,我收到如下错误:
错误消息说要将行 use_frameworks!
添加到名为 Podfile
的文件中。
将它添加到第一行下面,可能应该是 platform :ios, 'x.0'
。
您需要使用 ReactiveCocoa 4.0,目标是 Swift 2.0,但仍处于 alpha 版本。
如果您想尝试一下,请查看此内容。
use_frameworks!
target 'YOUR_TARGET' do
pod 'ReactiveCocoa', '~> 4.0.0-alpha'
end
在我的 pod 文件中尝试 use_frameworks!
之后,由于 ReactiveCocoa
和 .swift
文件,我仍然遇到错误(即使在自动更正 Xcode 试图为我修复)。
在我的 Podfile
中,我能够解决我遇到的两组错误:
1. 当在 Podfile 中包含 use_frameworks!
2. 另外当 运行 我原来的 pod install
希望添加 Parse cocoapod
Podfile 中的最终代码
pod 'ReactiveCocoa', '2.4.7'
pod 'SimpleAuth/Instagram', '0.3.6'
pod 'SSKeychain'
pod 'Parse'
您实际上可以请求最新版本的依赖项。您的 Podfile 应如下所示:
platform :ios, "9.0"
use_frameworks!
target 'MyAppNameHere' do
end
pod 'Box', :head
pod 'Result', :head
pod 'SimpleAuth/Instagram'
然后执行 pod update
并在您的项目中,Product > Clean
和 Product > Build
将再次工作。