diff --git a/ios/MBXViewController.mm b/ios/MBXViewController.mm index 8d734459c..06f60b314 100644 --- a/ios/MBXViewController.mm +++ b/ios/MBXViewController.mm @@ -377,7 +377,6 @@ class MBXMapView MBXMapView *mapView; CADisplayLink *displayLink; -NSOperationQueue *queue; namespace llmr { @@ -390,20 +389,13 @@ namespace llmr void request_http(std::string url, std::function background_function, std::function foreground_callback) { - [[NSNotificationCenter defaultCenter] postNotificationName:MBXUpdateActivityNotification object:nil userInfo:[NSDictionary dictionaryWithObject:@1 forKey:@"count"]]; - - if (!queue) - queue = [NSOperationQueue new]; - - NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@(url.c_str())]]; - - [NSURLConnection sendAsynchronousRequest:urlRequest - queue:queue - completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) + NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:[NSURL URLWithString:@(url.c_str())] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { + [[NSNotificationCenter defaultCenter] postNotificationName:MBXUpdateActivityNotification object:nil userInfo:[NSDictionary dictionaryWithObject:@(-1) forKey:@"count"]]; + Response res; - if (error == nil) + if ( ! error) { res.code = [(NSHTTPURLResponse *)response statusCode]; res.body = { (const char *)[data bytes], [data length] }; @@ -413,12 +405,15 @@ namespace llmr dispatch_async(dispatch_get_main_queue(), ^(void) { - foreground_callback(); - }); + foreground_callback(); - [[NSNotificationCenter defaultCenter] postNotificationName:MBXUpdateActivityNotification object:nil userInfo:[NSDictionary dictionaryWithObject:@(-1) forKey:@"count"]]; - [[NSNotificationCenter defaultCenter] postNotificationName:MBXNeedsRenderNotification object:nil]; + [[NSNotificationCenter defaultCenter] postNotificationName:MBXNeedsRenderNotification object:nil]; + }); }]; + + [[NSNotificationCenter defaultCenter] postNotificationName:MBXUpdateActivityNotification object:nil userInfo:[NSDictionary dictionaryWithObject:@1 forKey:@"count"]]; + + [task resume]; } double time() diff --git a/ios/llmr-app.gyp b/ios/llmr-app.gyp index b9cec1ca6..d29039726 100644 --- a/ios/llmr-app.gyp +++ b/ios/llmr-app.gyp @@ -37,7 +37,7 @@ 'INFOPLIST_FILE': 'Info.plist', 'CLANG_CXX_LIBRARY': 'libc++', 'CLANG_CXX_LANGUAGE_STANDARD':'c++11', - 'IPHONEOS_DEPLOYMENT_TARGET':'6.0', + 'IPHONEOS_DEPLOYMENT_TARGET':'7.0', 'TARGETED_DEVICE_FAMILY': '1,2', 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', 'CLANG_ENABLE_OBJC_ARC': 'YES' diff --git a/llmr.gyp b/llmr.gyp index bd94746fa..836a4d098 100644 --- a/llmr.gyp +++ b/llmr.gyp @@ -140,7 +140,7 @@ 'ARCHS': [ "armv7", "armv7s", "arm64", "i386" ], 'TARGETED_DEVICE_FAMILY': '1,2', 'CODE_SIGN_IDENTITY': 'iPhone Developer', - 'IPHONEOS_DEPLOYMENT_TARGET': '5.0', + 'IPHONEOS_DEPLOYMENT_TARGET': '7.0', 'PUBLIC_HEADERS_FOLDER_PATH': 'include', 'GCC_INPUT_FILETYPE':'sourcecode.cpp.cpp', 'OTHER_CPLUSPLUSFLAGS':[