Last Updated: February 25, 2016
·
2.046K
· wilhelmbot

Remove dispatch_release when iOS >= 6 || OSX >= 1080

Calling dispatch_release is forbidden under ARC in new iOS and OSX versions.

This preprocessor macro might help:

#define YourDispatchQueueRelease(q) (dispatch_release(q))
#if TARGET_OS_IPHONE
    #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000
        #define YourDispatchQueueRelease(q)
    #endif
#else
    #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
        #define YourDispatchQueueRelease(q)
    #endif
#endif

References:
https://github.com/ccgus/fmdb/commit/aef763eeb64e6fa654e7d121f1df4c
https://github.com/magicalpanda/MagicalRecord/pull/260

2 Responses
Add your response

if you set your deployment target properly, the compiler will do this for you, without having to resort to any of this.

over 1 year ago ·

Yeah, this is quite old. Thanks for the comment!

over 1 year ago ·