set googleMapApi timeout
parent
c030e31a5a
commit
99d074d023
|
@ -199,14 +199,18 @@
|
||||||
urlComponents.queryItems = queryItems;
|
urlComponents.queryItems = queryItems;
|
||||||
request.URL = urlComponents.URL;
|
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) {
|
if (error) {
|
||||||
NSLog(@"Error: %@", error);
|
NSLog(@"Error: %@", error);
|
||||||
completion(nil);
|
completion(nil);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
NSError *jsonError;
|
NSError *jsonError;
|
||||||
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
|
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
|
||||||
|
@ -220,8 +224,9 @@
|
||||||
completion(nil);
|
completion(nil);
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[task resume];
|
[task resume];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSArray *)convertPlaceDictToArray:(NSDictionary*)dict{
|
+ (NSArray *)convertPlaceDictToArray:(NSDictionary*)dict{
|
||||||
|
|
Loading…
Reference in New Issue