aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kola <georgekola@google.com>2017-03-08 22:32:33 -0800
committerMark Mentovai <mark@chromium.org>2017-03-09 16:11:07 +0000
commita784e84497395f0ddbd787bc95194f6037dd6dc4 (patch)
treef33bc416ebdda2751c707ffe1f35588e4c998ffa
parentFix segfault when interpreting bad debug_file (diff)
downloadbreakpad-a784e84497395f0ddbd787bc95194f6037dd6dc4.tar.xz
Use NSURLSession if the min version we support is iOS 7+.
Because many apps still support iOS 8, they were defaulting to deprecated NSURLConnection even if the code ran on iOS 10. NSURLConnection requires a run loop and hence the code did not always upload if the queue ran on a thread without a Run Loop. This should improve break pad uploads BUG= Change-Id: I7bff80ea977fd1ab13c8812ed933ef842dab417f Reviewed-on: https://chromium-review.googlesource.com/451880 Reviewed-by: Sylvain Defresne <sdefresne@chromium.org> Reviewed-by: Mark Mentovai <mark@chromium.org>
-rw-r--r--src/common/mac/HTTPMultipartUpload.m12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/common/mac/HTTPMultipartUpload.m b/src/common/mac/HTTPMultipartUpload.m
index 9ac886d5..f6d081e4 100644
--- a/src/common/mac/HTTPMultipartUpload.m
+++ b/src/common/mac/HTTPMultipartUpload.m
@@ -49,13 +49,13 @@ static NSString *PercentEncodeNSString(NSString *key) {
// As -[NSURLConnection sendSynchronousRequest:returningResponse:error:] has
// been deprecated with iOS 9.0 / OS X 10.11 SDKs, this function re-implements
-// it using -[NSURLSession dataTaskWithRequest:completionHandler:] when using
-// those SDKs.
+// it using -[NSURLSession dataTaskWithRequest:completionHandler:] which is
+// available on iOS 7+.
static NSData *SendSynchronousNSURLRequest(NSURLRequest *req,
NSURLResponse **out_response,
NSError **out_error) {
-#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && defined(__IPHONE_9_0) && \
- __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0) || \
+#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && defined(__IPHONE_7_0) && \
+ __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_0) || \
(defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \
defined(MAC_OS_X_VERSION_10_11) && \
MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11)
@@ -223,9 +223,7 @@ static NSData *SendSynchronousNSURLRequest(NSURLRequest *req,
// Add any files to the message
NSArray *fileNames = [files_ allKeys];
- count = [fileNames count];
- for (NSInteger i = 0; i < count; ++i) {
- NSString *name = [fileNames objectAtIndex:i];
+ for (NSString *name in fileNames) {
id fileOrData = [files_ objectForKey:name];
NSData *fileData;