Property with 'retain (or strong)' attribute must be of object type

最近项目中用到了AFNetworking,在iOS 6.0以上版本编译时可以正常运行,但在低于iOS 6.0的版本编译时,会编译失败,主要是报以下错误:

Property with 'retain (or strong)' attribute must be of object type

主要涉及AFURLConnectionOperation.h和AFURLSessionManager.h两个文件,由于低于iOS 6.0时,dispatch_queue_t ARC没有托管,所以会出现这样的情况。

解决如下

#if OS_OBJECT_USE_OBJC
@property (nonatomic, strong) dispatch_queue_t completionQueue;
#else
@property (nonatomic, assign) dispatch_queue_t completionQueue;
#endif

猜你喜欢

转载自eric-gao.iteye.com/blog/2099225
今日推荐