Merge branch 'fixes-for-strict-warnings' of https://github.com/ittybittyapps/AFNetworking into ittybittyapps-fixes-for-strict-warnings
Conflicts: AFNetworking/AFHTTPClient.m AFNetworking/AFHTTPRequestOperation.m AFNetworking/AFImageRequestOperation.h AFNetworking/AFNetworking.h AFNetworking/AFURLConnectionOperation.m
This commit is contained in:
commit
0f35164082
11 changed files with 81 additions and 73 deletions
|
|
@ -35,7 +35,7 @@
|
||||||
#import <netdb.h>
|
#import <netdb.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -148,14 +148,15 @@ NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value) {
|
||||||
if([value isKindOfClass:[NSDictionary class]]) {
|
if([value isKindOfClass:[NSDictionary class]]) {
|
||||||
// Sort dictionary keys to ensure consistent ordering in query string, which is important when deserializing potentially ambiguous sequences, such as an array of dictionaries
|
// Sort dictionary keys to ensure consistent ordering in query string, which is important when deserializing potentially ambiguous sequences, such as an array of dictionaries
|
||||||
NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"description" ascending:YES selector:@selector(caseInsensitiveCompare:)];
|
NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"description" ascending:YES selector:@selector(caseInsensitiveCompare:)];
|
||||||
[[[value allKeys] sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]] enumerateObjectsUsingBlock:^(id nestedKey, NSUInteger idx, BOOL *stop) {
|
[[[value allKeys] sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]] enumerateObjectsUsingBlock:^(id nestedKey, __unused NSUInteger idx, __unused BOOL *stop) {
|
||||||
id nestedValue = [value objectForKey:nestedKey];
|
id nestedValue = [value objectForKey:nestedKey];
|
||||||
if (nestedValue) {
|
if (nestedValue) {
|
||||||
[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, NSUInteger idx, 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 {
|
||||||
|
|
@ -234,10 +235,10 @@ NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value) {
|
||||||
NSString *preferredLanguageCodes = [[NSLocale preferredLanguages] componentsJoinedByString:@", "];
|
NSString *preferredLanguageCodes = [[NSLocale preferredLanguages] componentsJoinedByString:@", "];
|
||||||
[self setDefaultHeader:@"Accept-Language" value:[NSString stringWithFormat:@"%@, en-us;q=0.8", preferredLanguageCodes]];
|
[self setDefaultHeader:@"Accept-Language" value:[NSString stringWithFormat:@"%@, en-us;q=0.8", preferredLanguageCodes]];
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
// User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43
|
// User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43
|
||||||
[self setDefaultHeader:@"User-Agent" value:[NSString stringWithFormat:@"%@/%@ (%@; iOS %@; Scale/%0.2f)", [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleExecutableKey] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleIdentifierKey], (__bridge id)CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleVersionKey) ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] ? [[UIScreen mainScreen] scale] : 1.0f)]];
|
[self setDefaultHeader:@"User-Agent" value:[NSString stringWithFormat:@"%@/%@ (%@; iOS %@; Scale/%0.2f)", [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleExecutableKey] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleIdentifierKey], (__bridge id)CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleVersionKey) ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] ? [[UIScreen mainScreen] scale] : 1.0f)]];
|
||||||
#elif __MAC_OS_X_VERSION_MIN_REQUIRED
|
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
||||||
[self setDefaultHeader:@"User-Agent" value:[NSString stringWithFormat:@"%@/%@ (Mac OS X %@)", [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleExecutableKey] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleIdentifierKey], [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey], [[NSProcessInfo processInfo] operatingSystemVersionString]]];
|
[self setDefaultHeader:@"User-Agent" value:[NSString stringWithFormat:@"%@/%@ (Mac OS X %@)", [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleExecutableKey] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleIdentifierKey], [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey], [[NSProcessInfo processInfo] operatingSystemVersionString]]];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -307,7 +308,7 @@ static const void * AFNetworkReachabilityRetainCallback(const void *info) {
|
||||||
return (__bridge_retained const void *)([(__bridge AFNetworkReachabilityStatusBlock)info copy]);
|
return (__bridge_retained const void *)([(__bridge AFNetworkReachabilityStatusBlock)info copy]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AFNetworkReachabilityReleaseCallback(const void *info) {}
|
static void AFNetworkReachabilityReleaseCallback(__unused const void *info) {}
|
||||||
|
|
||||||
- (void)startMonitoringNetworkReachability {
|
- (void)startMonitoringNetworkReachability {
|
||||||
[self stopMonitoringNetworkReachability];
|
[self stopMonitoringNetworkReachability];
|
||||||
|
|
@ -578,7 +579,7 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
__block NSUInteger numberOfFinishedOperations = 0;
|
__block NSUInteger numberOfFinishedOperations = 0;
|
||||||
[operations enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
[operations enumerateObjectsUsingBlock:^(id obj, __unused NSUInteger idx, __unused BOOL *stop) {
|
||||||
if ([(NSOperation *)obj isFinished]) {
|
if ([(NSOperation *)obj isFinished]) {
|
||||||
numberOfFinishedOperations++;
|
numberOfFinishedOperations++;
|
||||||
}
|
}
|
||||||
|
|
@ -671,7 +672,7 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {}
|
||||||
|
|
||||||
- (void)encodeWithCoder:(NSCoder *)aCoder {
|
- (void)encodeWithCoder:(NSCoder *)aCoder {
|
||||||
[aCoder encodeObject:self.baseURL forKey:@"baseURL"];
|
[aCoder encodeObject:self.baseURL forKey:@"baseURL"];
|
||||||
[aCoder encodeInteger:self.stringEncoding forKey:@"stringEncoding"];
|
[aCoder encodeInteger:(NSInteger)self.stringEncoding forKey:@"stringEncoding"];
|
||||||
[aCoder encodeInteger:self.parameterEncoding forKey:@"parameterEncoding"];
|
[aCoder encodeInteger:self.parameterEncoding forKey:@"parameterEncoding"];
|
||||||
[aCoder encodeObject:self.registeredHTTPOperationClassNames forKey:@"registeredHTTPOperationClassNames"];
|
[aCoder encodeObject:self.registeredHTTPOperationClassNames forKey:@"registeredHTTPOperationClassNames"];
|
||||||
[aCoder encodeObject:self.defaultHeaders forKey:@"defaultHeaders"];
|
[aCoder encodeObject:self.defaultHeaders forKey:@"defaultHeaders"];
|
||||||
|
|
@ -735,8 +736,8 @@ NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2;
|
||||||
@property (nonatomic, assign) BOOL hasInitialBoundary;
|
@property (nonatomic, assign) BOOL hasInitialBoundary;
|
||||||
@property (nonatomic, assign) BOOL hasFinalBoundary;
|
@property (nonatomic, assign) BOOL hasFinalBoundary;
|
||||||
|
|
||||||
@property (readonly, getter = hasBytesAvailable) BOOL bytesAvailable;
|
@property (nonatomic, readonly, getter = hasBytesAvailable) BOOL bytesAvailable;
|
||||||
@property (readonly) unsigned long long contentLength;
|
@property (nonatomic, readonly) unsigned long long contentLength;
|
||||||
|
|
||||||
- (NSInteger)read:(uint8_t *)buffer maxLength:(NSUInteger)length;
|
- (NSInteger)read:(uint8_t *)buffer maxLength:(NSUInteger)length;
|
||||||
@end
|
@end
|
||||||
|
|
@ -744,8 +745,8 @@ NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2;
|
||||||
@interface AFMultipartBodyStream : NSInputStream <NSStreamDelegate>
|
@interface AFMultipartBodyStream : NSInputStream <NSStreamDelegate>
|
||||||
@property (nonatomic, assign) NSUInteger numberOfBytesInPacket;
|
@property (nonatomic, assign) NSUInteger numberOfBytesInPacket;
|
||||||
@property (nonatomic, assign) NSTimeInterval delay;
|
@property (nonatomic, assign) NSTimeInterval delay;
|
||||||
@property (readonly) unsigned long long contentLength;
|
@property (nonatomic, readonly) unsigned long long contentLength;
|
||||||
@property (readonly, getter = isEmpty) BOOL empty;
|
@property (nonatomic, readonly, getter = isEmpty) BOOL empty;
|
||||||
|
|
||||||
- (id)initWithStringEncoding:(NSStringEncoding)encoding;
|
- (id)initWithStringEncoding:(NSStringEncoding)encoding;
|
||||||
- (void)setInitialAndFinalBoundaries;
|
- (void)setInitialAndFinalBoundaries;
|
||||||
|
|
@ -953,7 +954,7 @@ NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bytesRead += [self.currentHTTPBodyPart read:&buffer[bytesRead] maxLength:length - bytesRead];
|
bytesRead += [self.currentHTTPBodyPart read:&buffer[bytesRead] maxLength:(length - (NSUInteger)bytesRead)];
|
||||||
if (self.delay > 0.0f) {
|
if (self.delay > 0.0f) {
|
||||||
[NSThread sleepForTimeInterval:self.delay];
|
[NSThread sleepForTimeInterval:self.delay];
|
||||||
}
|
}
|
||||||
|
|
@ -963,7 +964,7 @@ NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2;
|
||||||
return bytesRead;
|
return bytesRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)getBuffer:(uint8_t **)buffer length:(NSUInteger *)len {
|
- (BOOL)getBuffer:(__unused uint8_t **)buffer length:(__unused NSUInteger *)len {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -988,20 +989,20 @@ NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2;
|
||||||
self.streamStatus = NSStreamStatusClosed;
|
self.streamStatus = NSStreamStatusClosed;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)propertyForKey:(NSString *)key {
|
- (id)propertyForKey:(__unused NSString *)key {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)setProperty:(id)property forKey:(NSString *)key {
|
- (BOOL)setProperty:(__unused id)property forKey:(__unused NSString *)key {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)scheduleInRunLoop:(NSRunLoop *)aRunLoop
|
- (void)scheduleInRunLoop:(__unused NSRunLoop *)aRunLoop
|
||||||
forMode:(NSString *)mode
|
forMode:(__unused NSString *)mode
|
||||||
{}
|
{}
|
||||||
|
|
||||||
- (void)removeFromRunLoop:(NSRunLoop *)aRunLoop
|
- (void)removeFromRunLoop:(__unused NSRunLoop *)aRunLoop
|
||||||
forMode:(NSString *)mode
|
forMode:(__unused NSString *)mode
|
||||||
{}
|
{}
|
||||||
|
|
||||||
- (unsigned long long)contentLength {
|
- (unsigned long long)contentLength {
|
||||||
|
|
@ -1015,17 +1016,17 @@ NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2;
|
||||||
|
|
||||||
#pragma mark - Undocumented CFReadStream Bridged Methods
|
#pragma mark - Undocumented CFReadStream Bridged Methods
|
||||||
|
|
||||||
- (void)_scheduleInCFRunLoop:(CFRunLoopRef)aRunLoop
|
- (void)_scheduleInCFRunLoop:(__unused CFRunLoopRef)aRunLoop
|
||||||
forMode:(CFStringRef)aMode
|
forMode:(__unused CFStringRef)aMode
|
||||||
{}
|
{}
|
||||||
|
|
||||||
- (void)_unscheduleFromCFRunLoop:(CFRunLoopRef)aRunLoop
|
- (void)_unscheduleFromCFRunLoop:(__unused CFRunLoopRef)aRunLoop
|
||||||
forMode:(CFStringRef)aMode
|
forMode:(__unused CFStringRef)aMode
|
||||||
{}
|
{}
|
||||||
|
|
||||||
- (BOOL)_setCFClientFlags:(CFOptionFlags)inFlags
|
- (BOOL)_setCFClientFlags:(__unused CFOptionFlags)inFlags
|
||||||
callback:(CFReadStreamClientCallBack)inCallback
|
callback:(__unused CFReadStreamClientCallBack)inCallback
|
||||||
context:(CFStreamClientContext *)inContext {
|
context:(__unused CFStreamClientContext *)inContext {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1121,17 +1122,17 @@ typedef enum {
|
||||||
|
|
||||||
if (_phase == AFEncapsulationBoundaryPhase) {
|
if (_phase == AFEncapsulationBoundaryPhase) {
|
||||||
NSData *encapsulationBoundaryData = [([self hasInitialBoundary] ? AFMultipartFormInitialBoundary() : AFMultipartFormEncapsulationBoundary()) dataUsingEncoding:self.stringEncoding];
|
NSData *encapsulationBoundaryData = [([self hasInitialBoundary] ? AFMultipartFormInitialBoundary() : AFMultipartFormEncapsulationBoundary()) dataUsingEncoding:self.stringEncoding];
|
||||||
bytesRead += [self readData:encapsulationBoundaryData intoBuffer:&buffer[bytesRead] maxLength:(length - bytesRead)];
|
bytesRead += [self readData:encapsulationBoundaryData intoBuffer:&buffer[bytesRead] maxLength:(length - (NSUInteger)bytesRead)];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_phase == AFHeaderPhase) {
|
if (_phase == AFHeaderPhase) {
|
||||||
NSData *headersData = [[self stringForHeaders] dataUsingEncoding:self.stringEncoding];
|
NSData *headersData = [[self stringForHeaders] dataUsingEncoding:self.stringEncoding];
|
||||||
bytesRead += [self readData:headersData intoBuffer:&buffer[bytesRead] maxLength:(length - bytesRead)];
|
bytesRead += [self readData:headersData intoBuffer:&buffer[bytesRead] maxLength:(length - (NSUInteger)bytesRead)];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_phase == AFBodyPhase) {
|
if (_phase == AFBodyPhase) {
|
||||||
if ([self.inputStream hasBytesAvailable]) {
|
if ([self.inputStream hasBytesAvailable]) {
|
||||||
bytesRead += [self.inputStream read:&buffer[bytesRead] maxLength:(length - bytesRead)];
|
bytesRead += [self.inputStream read:&buffer[bytesRead] maxLength:(length - (NSUInteger)bytesRead)];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (![self.inputStream hasBytesAvailable]) {
|
if (![self.inputStream hasBytesAvailable]) {
|
||||||
|
|
@ -1141,7 +1142,7 @@ typedef enum {
|
||||||
|
|
||||||
if (_phase == AFFinalBoundaryPhase) {
|
if (_phase == AFFinalBoundaryPhase) {
|
||||||
NSData *closingBoundaryData = ([self hasFinalBoundary] ? [AFMultipartFormFinalBoundary() dataUsingEncoding:self.stringEncoding] : [NSData data]);
|
NSData *closingBoundaryData = ([self hasFinalBoundary] ? [AFMultipartFormFinalBoundary() dataUsingEncoding:self.stringEncoding] : [NSData data]);
|
||||||
bytesRead += [self readData:closingBoundaryData intoBuffer:&buffer[bytesRead] maxLength:(length - bytesRead)];
|
bytesRead += [self readData:closingBoundaryData intoBuffer:&buffer[bytesRead] maxLength:(length - (NSUInteger)bytesRead)];
|
||||||
}
|
}
|
||||||
|
|
||||||
return bytesRead;
|
return bytesRead;
|
||||||
|
|
@ -1160,7 +1161,7 @@ typedef enum {
|
||||||
[self transitionToNextPhase];
|
[self transitionToNextPhase];
|
||||||
}
|
}
|
||||||
|
|
||||||
return range.length;
|
return (NSInteger)range.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)transitionToNextPhase {
|
- (BOOL)transitionToNextPhase {
|
||||||
|
|
@ -1182,6 +1183,7 @@ typedef enum {
|
||||||
[self.inputStream close];
|
[self.inputStream close];
|
||||||
_phase = AFFinalBoundaryPhase;
|
_phase = AFFinalBoundaryPhase;
|
||||||
break;
|
break;
|
||||||
|
case AFFinalBoundaryPhase:
|
||||||
default:
|
default:
|
||||||
_phase = AFEncapsulationBoundaryPhase;
|
_phase = AFEncapsulationBoundaryPhase;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -44,12 +44,12 @@
|
||||||
/**
|
/**
|
||||||
A Boolean value that corresponds to whether the status code of the response is within the specified set of acceptable status codes. Returns `YES` if `acceptableStatusCodes` is `nil`.
|
A Boolean value that corresponds to whether the status code of the response is within the specified set of acceptable status codes. Returns `YES` if `acceptableStatusCodes` is `nil`.
|
||||||
*/
|
*/
|
||||||
@property (readonly) BOOL hasAcceptableStatusCode;
|
@property (nonatomic, readonly) BOOL hasAcceptableStatusCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A Boolean value that corresponds to whether the MIME type of the response is among the specified set of acceptable content types. Returns `YES` if `acceptableContentTypes` is `nil`.
|
A Boolean value that corresponds to whether the MIME type of the response is among the specified set of acceptable content types. Returns `YES` if `acceptableContentTypes` is `nil`.
|
||||||
*/
|
*/
|
||||||
@property (readonly) BOOL hasAcceptableContentType;
|
@property (nonatomic, readonly) BOOL hasAcceptableContentType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The callback dispatch queue on success. If `NULL` (default), the main queue is used.
|
The callback dispatch queue on success. If `NULL` (default), the main queue is used.
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
@ -38,7 +42,7 @@ NSSet * AFContentTypesFromHTTPHeader(NSString *string) {
|
||||||
NSArray *mediaRanges = [string componentsSeparatedByString:@","];
|
NSArray *mediaRanges = [string componentsSeparatedByString:@","];
|
||||||
NSMutableSet *mutableContentTypes = [NSMutableSet setWithCapacity:mediaRanges.count];
|
NSMutableSet *mutableContentTypes = [NSMutableSet setWithCapacity:mediaRanges.count];
|
||||||
|
|
||||||
[mediaRanges enumerateObjectsUsingBlock:^(NSString *mediaRange, NSUInteger idx, BOOL *stop) {
|
[mediaRanges enumerateObjectsUsingBlock:^(NSString *mediaRange, __unused NSUInteger idx, __unused BOOL *stop) {
|
||||||
NSRange parametersRange = [mediaRange rangeOfString:@";"];
|
NSRange parametersRange = [mediaRange rangeOfString:@";"];
|
||||||
if (parametersRange.location != NSNotFound) {
|
if (parametersRange.location != NSNotFound) {
|
||||||
mediaRange = [mediaRange substringToIndex:parametersRange.location];
|
mediaRange = [mediaRange substringToIndex:parametersRange.location];
|
||||||
|
|
@ -105,8 +109,8 @@ static void AFSwizzleClassMethodWithClassAndSelectorUsingBlock(Class klass, SEL
|
||||||
@property (readwrite, nonatomic, strong) NSHTTPURLResponse *response;
|
@property (readwrite, nonatomic, strong) NSHTTPURLResponse *response;
|
||||||
@property (readwrite, nonatomic, strong) NSError *HTTPError;
|
@property (readwrite, nonatomic, strong) NSError *HTTPError;
|
||||||
@property (readwrite, nonatomic, copy) NSString *HTTPResponseString;
|
@property (readwrite, nonatomic, copy) NSString *HTTPResponseString;
|
||||||
@property (assign) long long totalContentLength;
|
@property (readwrite, nonatomic, assign) long long totalContentLength;
|
||||||
@property (assign) long long offsetContentLength;
|
@property (readwrite, nonatomic, assign) long long offsetContentLength;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation AFHTTPRequestOperation
|
@implementation AFHTTPRequestOperation
|
||||||
|
|
@ -299,7 +303,7 @@ static void AFSwizzleClassMethodWithClassAndSelectorUsingBlock(Class klass, SEL
|
||||||
+ (void)addAcceptableStatusCodes:(NSIndexSet *)statusCodes {
|
+ (void)addAcceptableStatusCodes:(NSIndexSet *)statusCodes {
|
||||||
NSMutableIndexSet *mutableStatusCodes = [[NSMutableIndexSet alloc] initWithIndexSet:[self acceptableStatusCodes]];
|
NSMutableIndexSet *mutableStatusCodes = [[NSMutableIndexSet alloc] initWithIndexSet:[self acceptableStatusCodes]];
|
||||||
[mutableStatusCodes addIndexes:statusCodes];
|
[mutableStatusCodes addIndexes:statusCodes];
|
||||||
AFSwizzleClassMethodWithClassAndSelectorUsingBlock([self class], @selector(acceptableStatusCodes), ^(id _self) {
|
AFSwizzleClassMethodWithClassAndSelectorUsingBlock([self class], @selector(acceptableStatusCodes), ^(__unused id _self) {
|
||||||
return mutableStatusCodes;
|
return mutableStatusCodes;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -311,7 +315,7 @@ static void AFSwizzleClassMethodWithClassAndSelectorUsingBlock(Class klass, SEL
|
||||||
+ (void)addAcceptableContentTypes:(NSSet *)contentTypes {
|
+ (void)addAcceptableContentTypes:(NSSet *)contentTypes {
|
||||||
NSMutableSet *mutableContentTypes = [[NSMutableSet alloc] initWithSet:[self acceptableContentTypes] copyItems:YES];
|
NSMutableSet *mutableContentTypes = [[NSMutableSet alloc] initWithSet:[self acceptableContentTypes] copyItems:YES];
|
||||||
[mutableContentTypes unionSet:contentTypes];
|
[mutableContentTypes unionSet:contentTypes];
|
||||||
AFSwizzleClassMethodWithClassAndSelectorUsingBlock([self class], @selector(acceptableContentTypes), ^(id _self) {
|
AFSwizzleClassMethodWithClassAndSelectorUsingBlock([self class], @selector(acceptableContentTypes), ^(__unused id _self) {
|
||||||
return mutableContentTypes;
|
return mutableContentTypes;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -326,7 +330,7 @@ static void AFSwizzleClassMethodWithClassAndSelectorUsingBlock(Class klass, SEL
|
||||||
|
|
||||||
#pragma mark - NSURLConnectionDelegate
|
#pragma mark - NSURLConnectionDelegate
|
||||||
|
|
||||||
- (void)connection:(NSURLConnection *)connection
|
- (void)connection:(__unused NSURLConnection *)connection
|
||||||
didReceiveResponse:(NSURLResponse *)response
|
didReceiveResponse:(NSURLResponse *)response
|
||||||
{
|
{
|
||||||
self.response = (NSHTTPURLResponse *)response;
|
self.response = (NSHTTPURLResponse *)response;
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,9 @@
|
||||||
|
|
||||||
#import <Availability.h>
|
#import <Availability.h>
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#elif __MAC_OS_X_VERSION_MIN_REQUIRED
|
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -54,13 +54,13 @@
|
||||||
/**
|
/**
|
||||||
An image constructed from the response data. If an error occurs during the request, `nil` will be returned, and the `error` property will be set to the error.
|
An image constructed from the response data. If an error occurs during the request, `nil` will be returned, and the `error` property will be set to the error.
|
||||||
*/
|
*/
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
@property (readonly, nonatomic, strong) UIImage *responseImage;
|
@property (readonly, nonatomic, strong) UIImage *responseImage;
|
||||||
#elif __MAC_OS_X_VERSION_MIN_REQUIRED
|
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
||||||
@property (readonly, nonatomic, strong) NSImage *responseImage;
|
@property (readonly, nonatomic, strong) NSImage *responseImage;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
/**
|
/**
|
||||||
The scale factor used when interpreting the image data to construct `responseImage`. Specifying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the size property. This is set to the value of scale of the main screen by default, which automatically scales images for retina displays, for instance.
|
The scale factor used when interpreting the image data to construct `responseImage`. Specifying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the size property. This is set to the value of scale of the main screen by default, which automatically scales images for retina displays, for instance.
|
||||||
*/
|
*/
|
||||||
|
|
@ -75,10 +75,10 @@
|
||||||
|
|
||||||
@return A new image request operation
|
@return A new image request operation
|
||||||
*/
|
*/
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
+ (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
+ (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
||||||
success:(void (^)(UIImage *image))success;
|
success:(void (^)(UIImage *image))success;
|
||||||
#elif __MAC_OS_X_VERSION_MIN_REQUIRED
|
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
||||||
+ (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
+ (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
||||||
success:(void (^)(NSImage *image))success;
|
success:(void (^)(NSImage *image))success;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -93,12 +93,12 @@
|
||||||
|
|
||||||
@return A new image request operation
|
@return A new image request operation
|
||||||
*/
|
*/
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
+ (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
+ (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
||||||
imageProcessingBlock:(UIImage *(^)(UIImage *image))imageProcessingBlock
|
imageProcessingBlock:(UIImage *(^)(UIImage *image))imageProcessingBlock
|
||||||
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success
|
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success
|
||||||
failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure;
|
failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure;
|
||||||
#elif __MAC_OS_X_VERSION_MIN_REQUIRED
|
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
||||||
+ (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
+ (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
||||||
imageProcessingBlock:(NSImage *(^)(NSImage *image))imageProcessingBlock
|
imageProcessingBlock:(NSImage *(^)(NSImage *image))imageProcessingBlock
|
||||||
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSImage *image))success
|
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSImage *image))success
|
||||||
|
|
|
||||||
|
|
@ -32,20 +32,20 @@ static dispatch_queue_t image_request_operation_processing_queue() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@interface AFImageRequestOperation ()
|
@interface AFImageRequestOperation ()
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
@property (readwrite, nonatomic, strong) UIImage *responseImage;
|
@property (readwrite, nonatomic, strong) UIImage *responseImage;
|
||||||
#elif __MAC_OS_X_VERSION_MIN_REQUIRED
|
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
||||||
@property (readwrite, nonatomic, strong) NSImage *responseImage;
|
@property (readwrite, nonatomic, strong) NSImage *responseImage;
|
||||||
#endif
|
#endif
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation AFImageRequestOperation
|
@implementation AFImageRequestOperation
|
||||||
@synthesize responseImage = _responseImage;
|
@synthesize responseImage = _responseImage;
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
@synthesize imageScale = _imageScale;
|
@synthesize imageScale = _imageScale;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
+ (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
+ (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
||||||
success:(void (^)(UIImage *image))success
|
success:(void (^)(UIImage *image))success
|
||||||
{
|
{
|
||||||
|
|
@ -55,7 +55,7 @@ static dispatch_queue_t image_request_operation_processing_queue() {
|
||||||
}
|
}
|
||||||
} failure:nil];
|
} failure:nil];
|
||||||
}
|
}
|
||||||
#elif __MAC_OS_X_VERSION_MIN_REQUIRED
|
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
||||||
+ (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
+ (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
||||||
success:(void (^)(NSImage *image))success
|
success:(void (^)(NSImage *image))success
|
||||||
{
|
{
|
||||||
|
|
@ -68,7 +68,7 @@ static dispatch_queue_t image_request_operation_processing_queue() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
+ (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
+ (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
||||||
imageProcessingBlock:(UIImage *(^)(UIImage *))imageProcessingBlock
|
imageProcessingBlock:(UIImage *(^)(UIImage *))imageProcessingBlock
|
||||||
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success
|
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success
|
||||||
|
|
@ -99,7 +99,7 @@ static dispatch_queue_t image_request_operation_processing_queue() {
|
||||||
|
|
||||||
return requestOperation;
|
return requestOperation;
|
||||||
}
|
}
|
||||||
#elif __MAC_OS_X_VERSION_MIN_REQUIRED
|
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
||||||
+ (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
+ (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
||||||
imageProcessingBlock:(NSImage *(^)(NSImage *))imageProcessingBlock
|
imageProcessingBlock:(NSImage *(^)(NSImage *))imageProcessingBlock
|
||||||
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSImage *image))success
|
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSImage *image))success
|
||||||
|
|
@ -137,7 +137,7 @@ static dispatch_queue_t image_request_operation_processing_queue() {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
self.imageScale = [[UIScreen mainScreen] scale];
|
self.imageScale = [[UIScreen mainScreen] scale];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -145,7 +145,7 @@ static dispatch_queue_t image_request_operation_processing_queue() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
- (UIImage *)responseImage {
|
- (UIImage *)responseImage {
|
||||||
if (!_responseImage && [self.responseData length] > 0 && [self isFinished]) {
|
if (!_responseImage && [self.responseData length] > 0 && [self isFinished]) {
|
||||||
UIImage *image = [UIImage imageWithData:self.responseData];
|
UIImage *image = [UIImage imageWithData:self.responseData];
|
||||||
|
|
@ -168,7 +168,7 @@ static dispatch_queue_t image_request_operation_processing_queue() {
|
||||||
|
|
||||||
self.responseImage = nil;
|
self.responseImage = nil;
|
||||||
}
|
}
|
||||||
#elif __MAC_OS_X_VERSION_MIN_REQUIRED
|
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
||||||
- (NSImage *)responseImage {
|
- (NSImage *)responseImage {
|
||||||
if (!_responseImage && [self.responseData length] > 0 && [self isFinished]) {
|
if (!_responseImage && [self.responseData length] > 0 && [self isFinished]) {
|
||||||
// Ensure that the image is set to it's correct pixel width and height
|
// Ensure that the image is set to it's correct pixel width and height
|
||||||
|
|
@ -216,9 +216,9 @@ static dispatch_queue_t image_request_operation_processing_queue() {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (success) {
|
if (success) {
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
UIImage *image = nil;
|
UIImage *image = nil;
|
||||||
#elif __MAC_OS_X_VERSION_MIN_REQUIRED
|
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
||||||
NSImage *image = nil;
|
NSImage *image = nil;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#import <Availability.h>
|
#import <Availability.h>
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#import "AFHTTPRequestOperation.h"
|
#import "AFHTTPRequestOperation.h"
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
static NSTimeInterval const kAFNetworkActivityIndicatorInvisibilityDelay = 0.17;
|
static NSTimeInterval const kAFNetworkActivityIndicatorInvisibilityDelay = 0.17;
|
||||||
|
|
||||||
@interface AFNetworkActivityIndicatorManager ()
|
@interface AFNetworkActivityIndicatorManager ()
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
#import "AFImageRequestOperation.h"
|
#import "AFImageRequestOperation.h"
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
#import "AFNetworkActivityIndicatorManager.h"
|
#import "AFNetworkActivityIndicatorManager.h"
|
||||||
#import "UIImageView+AFNetworking.h"
|
#import "UIImageView+AFNetworking.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@
|
||||||
|
|
||||||
@param handler A handler to be called shortly before the application’s remaining background time reaches 0. The handler is wrapped in a block that cancels the operation, and cleans up and marks the end of execution, unlike the `handler` parameter in `UIApplication -beginBackgroundTaskWithExpirationHandler:`, which expects this to be done in the handler itself. The handler is called synchronously on the main thread, thus blocking the application’s suspension momentarily while the application is notified.
|
@param handler A handler to be called shortly before the application’s remaining background time reaches 0. The handler is wrapped in a block that cancels the operation, and cleans up and marks the end of execution, unlike the `handler` parameter in `UIApplication -beginBackgroundTaskWithExpirationHandler:`, which expects this to be done in the handler itself. The handler is called synchronously on the main thread, thus blocking the application’s suspension momentarily while the application is notified.
|
||||||
*/
|
*/
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
- (void)setShouldExecuteAsBackgroundTaskWithExpirationHandler:(void (^)(void))handler;
|
- (void)setShouldExecuteAsBackgroundTaskWithExpirationHandler:(void (^)(void))handler;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#import "AFURLConnectionOperation.h"
|
#import "AFURLConnectionOperation.h"
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -40,7 +40,7 @@ typedef enum {
|
||||||
|
|
||||||
typedef signed short AFOperationState;
|
typedef signed short AFOperationState;
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
typedef UIBackgroundTaskIdentifier AFBackgroundTaskIdentifier;
|
typedef UIBackgroundTaskIdentifier AFBackgroundTaskIdentifier;
|
||||||
#else
|
#else
|
||||||
typedef id AFBackgroundTaskIdentifier;
|
typedef id AFBackgroundTaskIdentifier;
|
||||||
|
|
@ -199,7 +199,7 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
||||||
_outputStream = nil;
|
_outputStream = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
if (_backgroundTaskIdentifier) {
|
if (_backgroundTaskIdentifier) {
|
||||||
[[UIApplication sharedApplication] endBackgroundTask:_backgroundTaskIdentifier];
|
[[UIApplication sharedApplication] endBackgroundTask:_backgroundTaskIdentifier];
|
||||||
_backgroundTaskIdentifier = UIBackgroundTaskInvalid;
|
_backgroundTaskIdentifier = UIBackgroundTaskInvalid;
|
||||||
|
|
@ -218,8 +218,10 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
||||||
} else {
|
} else {
|
||||||
__weak __typeof(&*self)weakSelf = self;
|
__weak __typeof(&*self)weakSelf = self;
|
||||||
[super setCompletionBlock:^ {
|
[super setCompletionBlock:^ {
|
||||||
|
__strong __typeof(&*weakSelf)strongSelf = weakSelf;
|
||||||
|
|
||||||
block();
|
block();
|
||||||
[weakSelf setCompletionBlock:nil];
|
[strongSelf setCompletionBlock:nil];
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
[self.lock unlock];
|
[self.lock unlock];
|
||||||
|
|
@ -250,7 +252,7 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
||||||
[self didChangeValueForKey:@"outputStream"];
|
[self didChangeValueForKey:@"outputStream"];
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
- (void)setShouldExecuteAsBackgroundTaskWithExpirationHandler:(void (^)(void))handler {
|
- (void)setShouldExecuteAsBackgroundTaskWithExpirationHandler:(void (^)(void))handler {
|
||||||
[self.lock lock];
|
[self.lock lock];
|
||||||
if (!self.backgroundTaskIdentifier) {
|
if (!self.backgroundTaskIdentifier) {
|
||||||
|
|
@ -539,7 +541,7 @@ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite
|
||||||
{
|
{
|
||||||
if (self.uploadProgress) {
|
if (self.uploadProgress) {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
self.uploadProgress(bytesWritten, totalBytesWritten, totalBytesExpectedToWrite);
|
self.uploadProgress((NSUInteger)bytesWritten, totalBytesWritten, totalBytesExpectedToWrite);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import <objc/runtime.h>
|
#import <objc/runtime.h>
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
#import "UIImageView+AFNetworking.h"
|
#import "UIImageView+AFNetworking.h"
|
||||||
|
|
||||||
@interface AFImageCache : NSCache
|
@interface AFImageCache : NSCache
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue