cocoa pods因为墙的原因一直不好用,按rac官方的说法一直集成不成功:
最后粗爆的把RAC的源代码直接拷贝到了工程中,解决方法如下:
1、将ReactiveCocoa目录拷贝到工程中,并加入工程中。
2、ReactiveCocoa.h中mac相关的类删除。并将#import <>的方式改成 #import ""方式3、Build Phrases中,将RACObjCRuntime.m加上flag:-fno-objc-arc。
官方的说明:
Importing ReactiveCocoa
To add RAC to your application:
Add the ReactiveCocoa repository as a submodule of your application's repository.
Run script/bootstrap from within the ReactiveCocoa folder.
Drag and drop ReactiveCocoa.xcodeproj into your application's Xcode project or workspace.
On the "Build Phases" tab of your application target, add RAC to the "Link Binary With Libraries" phase.
On iOS, add libReactiveCocoa-iOS.a.
On OS X, add ReactiveCocoa.framework. RAC must also be added to any "Copy Frameworks" build phase. If you don't already have one, simply add a "Copy Files" build phase and target the "Frameworks" destination.
Add "$(BUILD_ROOT)/../IntermediateBuildFilesPath/UninstalledProducts/include" $(inherited) to the "Header Search Paths" build setting (this is only necessary for archive builds, but it has no negative effect otherwise).
For iOS targets, add -ObjC to the "Other Linker Flags" build setting.
If you added RAC to a project (not a workspace), you will also need to add the appropriate RAC target to the "Target Dependencies" of your application.
If you would prefer to use CocoaPods, there are some ReactiveCocoa podspecs that have been generously contributed by third parties.
To see a project already set up with RAC, check out C-41 or GroceryList, which are real iOS apps written using ReactiveCocoa.