In my class, I have a dispatch_queue_t property declared as follows:
@property (nonatomic, assign) dispatch_queue_t queue;
Then in my init method I do:
- (id)initWithServerUrls: (NSString*)serverUrls { if (self = [super init]) { _queue = dispatch_queue_create("com.xxx.my_send_queue", DISPATCH_QUEUE_SERIAL); } return self; }
In Xcode 4.4.1, it worked and did not cause problems (application checked + in appstore). Now, after I upgraded to Xcode 4.5, the application crashes with EXC_BAD_ACCESS , and Xcode gives me a warning on this line:
Assigning a saved object to unsafe_unretained; the object will be released after the appointment
Apple has updated the compiler in Xcode 4.5 from LLVM 4.0 to LLVM 4.1, but I donβt know why my code is crashing right now.
I went through the code, and the accident occurred immediately after this line. Do you have any ideas what might be wrong and how can I fix it?
DECISION:
I managed to get it to work with both SDKs. I just added:
#if OS_OBJECT_USE_OBJC @property (nonatomic, strong) dispatch_queue_t queue; // this is for Xcode 4.5 with LLVM 4.1 and iOS 6 SDK #else @property (nonatomic, assign) dispatch_queue_t queue; // this is for older Xcodes with older SDKs #endif
Hope someone finds this helpful
source share