jasenhuang/NSObjectSafe

跟ReactiveCocoa不兼容

Closed this issue · 5 comments

用你这个,ReactiveCocoa就不兼容了,报错

  • (RACSignal *)rac_valuesForKeyPath:(NSString *)keyPath observer:(__weak NSObject *)observer;
  • (RACSignal *)rac_valuesAndChangesForKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options observer:(__weak NSObject *)observer;
    不能使用__weak

we use it in our project with ReactiveCocoa and it works well.
show the error log?

我用的是ReactiveCocoa 2.5版本,在这几个类NSObject+RACKVOWrapper,NSObject+RACPropertySubscribing,RACKVOChannel等等,凡是用__weak修饰NSObject的地方,都会报错, Cannot create __weak reference in file using manual reference counting

解决了,Set Build
Settings -> Apple LLVM 8.1 - Language - Objective C -> Weak References in Manual Retain Release to YES.

"Cannot create __weak reference in file using manual reference counting" ?
we don't need to change "Weak References in Manual Retain Release" setting, does your project still use MRC?

我用的ARC啊,但是你的这个文件不是要用MRC,我配置了-fno-objc-arc,文件不报错了,但是跟ReactiveCocoa又冲突了,报Cannot create __weak reference in file using manual reference counting,这个错误,我设置Weak References in Manual Retain Release = YES就好了