How can I fix my install of ReactiveCocoa (with CocoaPods)?

别来无恙 提交于 2019-12-10 20:57:09

问题


Newbie here, trying to install ReactiveCocoa 2.2.4 with CocoaPods into a project and running into errors at runtime. I have used this podspec on github. Here's my code --

MainViewController.m @interface has:

@property (strong, nonatomic) NSString *testString;

MainViewController.m viewDidLoad() has:

self.testString = @"hello";
[RACObserve(self, testString) subscribeNext:^(NSString *newString) {
    NSLog(@"%@", newString);
}];
self.testString = @"yellow";

This is the runtime error I get, where it looks as though "self" is getting the selector sent to it instead of "testString":

exception 'NSInvalidArgumentException', reason: '-[MainViewController rac_valuesForKeyPath:observer:]: unrecognized selector sent to instance

FWIW, I have been able to successfully install ReactiveCocoa via CocoaPods twice in two fresh xcode projects following this youtube vid -- both with and without the podspec i'm trying to use in my other project.

More info about my setup:

  • Xcode 5
  • In Target: General: Linked Libraries and Frameworks: libPods.a (in black -- weirdly, in the new projects where ReactiveCocoa works, this is red)
  • In Target: Build Settings: Other Linker Flags: -ObjC and -all_load (even though my understanding is that adding these is no longer necessary. also, whether I have them or not, i still get the same result).
  • In Target: Build Settings: Header Search Paths: (all non-recursive, all added by CocoaPods): "${PODS_ROOT}/Headers", "${PODS_ROOT}/Headers/ReactiveCocoa", "${PODS_ROOT}/Headers/ReactiveCocoa/ReactiveCocoa"
  • In Target: Build Phases: Target Dependencies: nada (do I need something here?)
  • In Target: Build Phases: Link Binary With Libraries: : libPods.a (in black -- weirdly, in the new projects where ReactiveCocoa works, this is red)

Thanks for any help!

来源:https://stackoverflow.com/questions/21947533/how-can-i-fix-my-install-of-reactivecocoa-with-cocoapods

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!