Last Updated: February 25, 2016
·
7.901K
· siuying

dispatch_release is no longer needed in iOS 6 with ARC

If you used GCD or library that depends on it (e.g. Reachability), you should know dispatch_release is no longer needed in iOS 6 with ARC. In fact, if you try to use it, it is a compiler error, just like what happen when you call release in earlier SDK.

To fix it, you may want to remove the dispatch_release, or use preprocessor:

/* header */
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000
    #define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else                                         // iOS 5.X or earlier
    #define NEEDS_DISPATCH_RETAIN_RELEASE 1
#endif

/* implementation */
#if NEEDS_DISPATCH_RETAIN_RELEASE
    dispatch_release(self.reachabilitySerialQueue);
#endif