Closed bibobode closed 8 years ago
It's not clear to me why the bridging was necessary in the first place, and why this doesn't suffice (it compiles):
id impBlockForIMP = block;
Would somebody please be able to explain?
Are there any concerns to block this PR to merge into master?
@lawrence-forooghian Your approach compiles. However, my concern is that your code may fail to compile on older Xcode versions. What do you think?
@huy-le I'm not sure what the process is for having it merged, but no one has expressed any concerns in the past few weeks.
@bibobode Is this approach backwards-compatible? If not, then we need conditional compilation so that earlier SDK versions can still build.
@odrobnik Thank you for getting back so promptly :)
Yes, it is backwards compatible.
If you look at the Objective-C runtime header (http://opensource.apple.com/source/objc4/objc4-532/runtime/objc.h), you'll notice that it defines objc_unretainedPointer(o)
as ((__bridge objc_objectptr_t)(id)(o))
. Note that objc_objectptr_t
is a typedef for void *
. block
is already defined as an id
type so the remaining cast is unnecessary.
Replaces the unavailable 'objc_unretainedPointer' in Xcode 8 with a __bridge cast to resolve build error.