Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

RC2 won't compile under XCode 4.5 #417

Closed
duanefields opened this Issue · 6 comments

5 participants

@duanefields

line 59 of AFHTTPRequestOperation.m complains of Implicit conversion of C pointer type 'void *' to Objective-C pointer type 'id'.

Should read (I think)

IMP implementation = imp_implementationWithBlock((__bridge id)(block));
@gcox gcox referenced this issue from a commit
@gcox gcox Fixed compiler error in AFHTTPRequestOperation; #417
Casting (void *) block to (__bridge id).  Required as of Xcode 4.4
1090378
@sjmadsen sjmadsen referenced this issue from a commit in lightyear/AFNetworking
@sjmadsen sjmadsen Repair compilation on Xcode < 4.5. (#417) 9f9570f
@sjmadsen

Unfortunately, the previous fix breaks compilation on Xcode 4.4, which we still must use for app submissions. The root cause is that Apple changed the signature of imp_implementationWithBlock in the iOS 6.0 SDK.

@joshuatbrown

Xcode 4.5 can now be used to submit apps, but perhaps Xcode 4.4 should still be supported.

@sjmadsen Does your fix work with both Xcode 4.4 and Xcode 4.5?

@tewha

I think this will work:

#ifdef __IPHONE_6_0
#define BLOCKTYPE id
#else
#define BLOCKTYPE __bridge void *
#endif

Then cast to BLOCKTYPE.

Reasoning:

  1. The new SDK defines __IPHONE_6_0. If there's a way to detect the SDK version, even better, but I couldn't find one.
  2. Casting a block to an id is safe.
  3. Casting a block to __bridge void * is the required magic for older SDKs.
@tewha

I did this in my code here:

tewha/iOS-Subscripting@258b176

@mattt

Thanks for the tip, @tewha. I've managed to get everything working in 4.4 and 4.5 in c8d9f79.

@mattt mattt closed this
@tewha

I like that you've managed to contain this to your .m files. This is the sort of thing you really don't want to be offering to others to use.

@egrim egrim referenced this issue from a commit in egrim/AFNetworking
@gcox gcox Fixed compiler error in AFHTTPRequestOperation; #417
Casting (void *) block to (__bridge id).  Required as of Xcode 4.4
5d31cee
@egrim egrim referenced this issue from a commit in egrim/AFNetworking
@mattt mattt [#417] Fixing compilation error in Xcode 4.5 7bc6fa5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.