首先,使用CocoaPods集成(注意:因爲ReactiveCocoa須要iOS8.0,而且是與swift混編的,因此Podfile文件要寫成platform :ios, '8.0' 和 use_frameworks!),單集成沒問題,但項目裏用到SSKeychain,只要用到use_frameworks!老是報SSKeychain重複,把SSKeychain摘出來不用cocoaPods管理也是不行。html
因而用第二套方案:GitHub上官方提供的方法:ios
To add RAC to your application:git
script/bootstrap
from within the ReactiveCocoa folder.ReactiveCocoa.xcodeproj
and Carthage/Checkouts/Result/Result.xcodeproj
into your application’s Xcode project or workspace.ReactiveCocoa.framework
and Result.framework
to the 「Embedded Binaries」 section.EMBEDDED_CONTENT_CONTAINS_SWIFT
build setting to 「Yes」.補充:github
一、2兩步請參考這裏,三、四、5跟着作就好。而後build,會報錯:bootstrap
(null): error: /Users/xianfx/Documents/優化/XinfuPlatform/external/ReactiveCocoa/Carthage/Checkouts/Result/build/Debug-iphoneos/Result.framework: No such file or directoryswift
(null): error: /Users/xianfx/Documents/優化/XinfuPlatform/external/ReactiveCocoa/build/Debug-iphoneos/ReactiveCocoa.framework: No such file or directoryxcode
解決辦法是:找到項目的.xcodeproj文件 -> 顯示包內容 -> 打開 project.pbxproj 文件,找到對應路徑,刪除便可。app
使用,又報錯:iphone
dyld: Library not loaded: @rpath/libswiftCore.dylib優化
Referenced from: /Users/xianfx/Library/Developer/Xcode/DerivedData/XinfuPlatform-fsgkjtwplnourtaicvecgysbcqhq/Build/Products/Debug-iphonesimulator/ReactiveCocoa.framework/ReactiveCocoa
Reason: image not found
好吧,中間停了很久沒搞了,今天又試了下,看到了這個記錄,解決了:targets -> BuildSettings ->Embedded Content Contains Swift code 設置成YES。
僅供參考!