Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaces the unavailable 'objc_unretainedPointer' in Xcode 8 #107

Merged
merged 1 commit into from
Aug 12, 2016
Merged

Replaces the unavailable 'objc_unretainedPointer' in Xcode 8 #107

merged 1 commit into from
Aug 12, 2016

Conversation

bibobode
Copy link

Replaces the unavailable 'objc_unretainedPointer' in Xcode 8 with a __bridge cast to resolve build error.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 41.723% when pulling 42ccd52 on bibobode:xcode8-build-error-fix into 4932fef on Cocoanetics:develop.

@ghost
Copy link

ghost commented Jul 20, 2016

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?

@huy-le
Copy link

huy-le commented Aug 5, 2016

Are there any concerns to block this PR to merge into master?

@bibobode
Copy link
Author

bibobode commented Aug 8, 2016

@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.

@odrobnik
Copy link
Collaborator

odrobnik commented Aug 9, 2016

@bibobode Is this approach backwards-compatible? If not, then we need conditional compilation so that earlier SDK versions can still build.

@bibobode
Copy link
Author

bibobode commented Aug 9, 2016

@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.

@odrobnik odrobnik merged commit bd8e21d into Cocoanetics:develop Aug 12, 2016
@odrobnik odrobnik mentioned this pull request Aug 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants