Created
March 28, 2012 15:56
-
-
Save lprhodes/2227668 to your computer and use it in GitHub Desktop.
//Return type 'id' must match previous return type 'void *' when block literal has unspecified explicit return type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Return type 'id' must match previous return type 'void *' when block literal has unspecified explicit return type | |
typedef id (^AEURLResponseProcessor)(NSURLResponse *, id, NSError **); | |
+ (AEURLResponseProcessor)statusCode:(NSIndexSet *)acceptableCodes { | |
return [[^(NSURLResponse *response, id data, NSError **error){ | |
if (![response isKindOfClass:[NSHTTPURLResponse class]]) { | |
if (error) { | |
*error = [AEExpect error:AEExpectResponseNotHTTPError | |
message:@"Response is not HTTP"]; | |
} | |
return nil; | |
} | |
NSInteger statusCode = [(NSHTTPURLResponse *)response statusCode]; | |
if (![acceptableCodes containsIndex:statusCode]) { | |
if (error) { | |
*error = [AEExpect error:AEExpectInvalidStatusCodeError | |
message:[NSString stringWithFormat:@"%@ (HTTP status %d)", | |
[NSHTTPURLResponse localizedStringForStatusCode:statusCode], | |
statusCode]]; | |
} | |
return nil; | |
} | |
//Return type 'id' must match previous return type 'void *' when block literal has unspecified explicit return type | |
return data; | |
} copy] autorelease]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment