How to install ReactiveCocoa properly using CocoaP

2019-04-11 02:18发布

问题:

I'm very new to ReactiveCocoa. I tried to install ReactiveCocoa a couple of days ago via CocoaPods. Here is my podFile:

platform :ios , '7.0'
pod 'ReactiveCocoa'

After using pod install I have the log file here:

Analyzing dependencies

Downloading dependencies

Using ReactiveCocoa (2.0)

Generating Pods project

Integrating client project

And then I open myproject.xworkspace and #import <ReactiveCocoa.h> to start using the framework. But the problem is I cannot get it worked

For example in my code I have this line: objc RACSignal *usernameSignal = self._usernameTextField.rac_textSignal; But when I run the project, it showed up this debug error

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITextField rac_textSignal]: unrecognized selector sent to instance 0xb933a70'

I believed that I might do something wrong with the framework installation here. Anyone please help me out!

I'm using XCode5 and iOS7.0

回答1:

I figured out the issues. It's because CocoaPods doesn't add the flag -all_load in my project build setting. After setting it manually, it works like a charm. Hope this help everyone who experience the same issue like me