简体   繁体   中英

Objective C Project in Xcode 7 CocoaPods Error

The Terminal Error I am receiving after running pod install is: 在此处输入图片说明

I realize that ReactiveCocoa 's cocoapod is entirely in SWIFT and that I need to Bridge the header files, but my attempts have been far from successful.

I did find this response from one of TeamTreehouse's Staff:

" 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."

.

^^ Explains my Problem ^^

Thanks in advance!

Edit

After adding use_frameworks! to my Podfile, I was receiving errors like:

在此处输入图片说明

The error message says to add the line use_frameworks! to your file called Podfile .

Add it below the first line that should probably say platform :ios, 'x.0' .

You need to use ReactiveCocoa 4.0, which is target Swift 2.0, yet still under alpha version.

If you want to have a try, check this out.

use_frameworks!

target 'YOUR_TARGET' do
    pod 'ReactiveCocoa', '~> 4.0.0-alpha'
end

After attempting use_frameworks! within my pod file, I was still experiencing errors due to ReactiveCocoa and the .swift files (even after auto-correcting the errors that Xcode attempted to fix for me).

Within my Podfile I was able to resolve both sets of errors I was experiencing: 1. When including use_frameworks! in the Podfile 2. Also when running my original pod install in hopes of adding the Parse cocoapod

Final code in Podfile

pod 'ReactiveCocoa', '2.4.7'
pod 'SimpleAuth/Instagram', '0.3.6'
pod 'SSKeychain'
pod 'Parse'

You can actually request the latest version of the dependencies. Your Podfile should look like this:

platform :ios, "9.0"
use_frameworks!

target 'MyAppNameHere' do

    end

pod 'Box', :head
pod 'Result', :head
pod 'SimpleAuth/Instagram'

Then peform a pod update and in your project, Product > Clean and Product > Build and will work again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM