|
@@ -136,7 +136,7 @@ NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value) {
|
|
|
NSDictionary *dictionary = value;
|
|
|
// Sort dictionary keys to ensure consistent ordering in query string, which is important when deserializing potentially ambiguous sequences, such as an array of dictionaries
|
|
|
for (id nestedKey in [dictionary.allKeys sortedArrayUsingDescriptors:@[ sortDescriptor ]]) {
|
|
|
- id nestedValue = [dictionary objectForKey:nestedKey];
|
|
|
+ id nestedValue = dictionary[nestedKey];
|
|
|
if (nestedValue) {
|
|
|
[mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue((key ? [NSString stringWithFormat:@"%@[%@]", key, nestedKey] : nestedKey), nestedValue)];
|
|
|
}
|
|
@@ -218,9 +218,9 @@ static void *AFHTTPRequestSerializerObserverContext = &AFHTTPRequestSerializerOb
|
|
|
#pragma clang diagnostic ignored "-Wgnu"
|
|
|
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
|
|
// User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43
|
|
|
- userAgent = [NSString stringWithFormat:@"%@/%@ (%@; iOS %@; Scale/%0.2f)", [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleExecutableKey] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleIdentifierKey], [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], [[UIScreen mainScreen] scale]];
|
|
|
+ userAgent = [NSString stringWithFormat:@"%@/%@ (%@; iOS %@; Scale/%0.2f)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], [[UIScreen mainScreen] scale]];
|
|
|
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
|
|
- userAgent = [NSString stringWithFormat:@"%@/%@ (Mac OS X %@)", [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleExecutableKey] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleIdentifierKey], [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleVersionKey], [[NSProcessInfo processInfo] operatingSystemVersionString]];
|
|
|
+ userAgent = [NSString stringWithFormat:@"%@/%@ (Mac OS X %@)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[NSProcessInfo processInfo] operatingSystemVersionString]];
|
|
|
#endif
|
|
|
#pragma clang diagnostic pop
|
|
|
if (userAgent) {
|
|
@@ -730,7 +730,7 @@ NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2;
|
|
|
bodyPart.headers = mutableHeaders;
|
|
|
bodyPart.boundary = self.boundary;
|
|
|
bodyPart.body = fileURL;
|
|
|
- bodyPart.bodyContentLength = [[fileAttributes objectForKey:NSFileSize] unsignedLongLongValue];
|
|
|
+ bodyPart.bodyContentLength = [fileAttributes[NSFileSize] unsignedLongLongValue];
|
|
|
[self.bodyStream appendHTTPBodyPart:bodyPart];
|
|
|
|
|
|
return YES;
|
|
@@ -873,7 +873,7 @@ NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2;
|
|
|
bodyPart.hasFinalBoundary = NO;
|
|
|
}
|
|
|
|
|
|
- [[self.HTTPBodyParts objectAtIndex:0] setHasInitialBoundary:YES];
|
|
|
+ [[self.HTTPBodyParts firstObject] setHasInitialBoundary:YES];
|
|
|
[[self.HTTPBodyParts lastObject] setHasFinalBoundary:YES];
|
|
|
}
|
|
|
}
|