From 99d074d023efc1ddc7e06dd2fc5486fd7d2180e1 Mon Sep 17 00:00:00 2001 From: Stewen <784547228@qq.com> Date: Wed, 23 Aug 2023 17:33:29 +0800 Subject: [PATCH] set googleMapApi timeout --- ios/Classes/FinAppletExt/Common/Util/FATExtUtil.m | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ios/Classes/FinAppletExt/Common/Util/FATExtUtil.m b/ios/Classes/FinAppletExt/Common/Util/FATExtUtil.m index 505935f..a481129 100644 --- a/ios/Classes/FinAppletExt/Common/Util/FATExtUtil.m +++ b/ios/Classes/FinAppletExt/Common/Util/FATExtUtil.m @@ -199,14 +199,18 @@ urlComponents.queryItems = queryItems; request.URL = urlComponents.URL; } - - NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { + + NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; + configuration.timeoutIntervalForRequest = 5.0; + NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration]; + + NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { if (error) { NSLog(@"Error: %@", error); completion(nil); return; } - + if (data) { NSError *jsonError; NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError]; @@ -220,8 +224,9 @@ completion(nil); } }]; - + [task resume]; + } + (NSArray *)convertPlaceDictToArray:(NSDictionary*)dict{