Skip to content

RC2 won't compile under XCode 4.5 #417

Closed
duanefields opened this Issue Jul 19, 2012 · 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 added a commit that referenced this issue Jul 26, 2012
@gcox gcox Fixed compiler error in AFHTTPRequestOperation; #417
Casting (void *) block to (__bridge id).  Required as of Xcode 4.4
1090378
@sjmadsen sjmadsen added a commit to lightyear/AFNetworking that referenced this issue Aug 22, 2012
@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
tewha commented Sep 13, 2012

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
tewha commented Sep 13, 2012

I did this in my code here:

tewha/iOS-Subscripting@258b176

@mattt
mattt commented Sep 14, 2012

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

@mattt mattt closed this Sep 14, 2012
@tewha
tewha commented Sep 14, 2012

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 pushed a commit to egrim/AFNetworking that referenced this issue Sep 18, 2012
@gcox gcox Fixed compiler error in AFHTTPRequestOperation; #417
Casting (void *) block to (__bridge id).  Required as of Xcode 4.4
5d31cee
@egrim egrim pushed a commit to egrim/AFNetworking that referenced this issue Sep 18, 2012
@mattt mattt [#417] Fixing compilation error in Xcode 4.5 7bc6fa5
@greghe greghe pushed a commit to skillz/AFNetworking that referenced this issue Sep 3, 2015
@gcox gcox Fixed compiler error in AFHTTPRequestOperation; #417
Casting (void *) block to (__bridge id).  Required as of Xcode 4.4
bd08830
@greghe greghe pushed a commit to skillz/AFNetworking that referenced this issue Sep 3, 2015
@mattt mattt [#417] Fixing compilation error in Xcode 4.5 d1f6145
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.