Fixes warning: multiple methods named 'selector' found [-Werror,-Wstrict-selector-match]

This commit is contained in:
Oliver Jones 2012-11-29 18:46:04 +11:00
parent 23b8fe33ba
commit 3997dbb7e9
3 changed files with 15 additions and 5 deletions

View file

@ -150,7 +150,8 @@ NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value) {
[mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue((key ? [NSString stringWithFormat:@"%@[%@]", key, nestedKey] : nestedKey), nestedValue)]; [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue((key ? [NSString stringWithFormat:@"%@[%@]", key, nestedKey] : nestedKey), nestedValue)];
}]; }];
} else if([value isKindOfClass:[NSArray class]]) { } else if([value isKindOfClass:[NSArray class]]) {
[value enumerateObjectsUsingBlock:^(id nestedValue, __unused NSUInteger idx, __unused BOOL *stop) { NSArray *array = value;
[array enumerateObjectsUsingBlock:^(id nestedValue, __unused NSUInteger idx, __unused BOOL *stop) {
[mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue([NSString stringWithFormat:@"%@[]", key], nestedValue)]; [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue([NSString stringWithFormat:@"%@[]", key], nestedValue)];
}]; }];
} else { } else {
@ -295,7 +296,8 @@ static void AFNetworkReachabilityCallback(SCNetworkReachabilityRef __unused targ
block(status); block(status);
} }
[[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingReachabilityDidChangeNotification object:nil userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithInteger:status] forKey:AFNetworkingReachabilityNotificationStatusItem]]; NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter postNotificationName:AFNetworkingReachabilityDidChangeNotification object:nil userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithInteger:status] forKey:AFNetworkingReachabilityNotificationStatusItem]];
} }
static const void * AFNetworkReachabilityRetainCallback(const void *info) { static const void * AFNetworkReachabilityRetainCallback(const void *info) {

View file

@ -30,6 +30,10 @@
#define AF_CAST_TO_BLOCK __bridge void * #define AF_CAST_TO_BLOCK __bridge void *
#endif #endif
// We do a little bit of duck typing in this file which can trigger this warning. Turn it off for this source file.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wstrict-selector-match"
NSSet * AFContentTypesFromHTTPHeader(NSString *string) { NSSet * AFContentTypesFromHTTPHeader(NSString *string) {
if (!string) { if (!string) {
return nil; return nil;

View file

@ -310,12 +310,14 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
[self didChangeValueForKey:oldStateKey]; [self didChangeValueForKey:oldStateKey];
[self didChangeValueForKey:newStateKey]; [self didChangeValueForKey:newStateKey];
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
switch (state) { switch (state) {
case AFOperationExecutingState: case AFOperationExecutingState:
[[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingOperationDidStartNotification object:self]; [notificationCenter postNotificationName:AFNetworkingOperationDidStartNotification object:self];
break; break;
case AFOperationFinishedState: case AFOperationFinishedState:
[[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingOperationDidFinishNotification object:self]; [notificationCenter postNotificationName:AFNetworkingOperationDidFinishNotification object:self];
break; break;
default: default:
break; break;
@ -351,7 +353,9 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
if ([self isExecuting]) { if ([self isExecuting]) {
[self.connection performSelector:@selector(cancel) onThread:[[self class] networkRequestThread] withObject:nil waitUntilDone:NO modes:[self.runLoopModes allObjects]]; [self.connection performSelector:@selector(cancel) onThread:[[self class] networkRequestThread] withObject:nil waitUntilDone:NO modes:[self.runLoopModes allObjects]];
[[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingOperationDidFinishNotification object:self];
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter postNotificationName:AFNetworkingOperationDidFinishNotification object:self];
} }
self.state = AFOperationPausedState; self.state = AFOperationPausedState;