簡體   English   中英

Xcode 7 CocoaPods 中的 Objective C 項目錯誤

[英]Objective C Project in Xcode 7 CocoaPods Error

運行pod install后我收到的終端錯誤是: 在此處輸入圖片說明

我意識到ReactiveCocoa的 cocoapod 完全在 SWIFT 中,我需要接頭文件,但我的嘗試遠未成功。

我確實從 TeamTreehouse 的一名員工那里找到了這個回應:

" 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

在嘗試use_frameworks! 在我的 pod 文件中,由於ReactiveCocoa.swift文件,我仍然遇到錯誤(即使在自動更正了 Xcode 試圖為我修復的錯誤之后)。

在我的Podfile我能夠解決我遇到的兩組錯誤: 1. 當包含use_frameworks 時! 在 Podfile 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 and Product > Build將再次運行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM