iOS谷歌反向地理编码无法正常工作

时间:2015-12-14 14:49:58

标签: objective-c ios9 nsurlsession sendasynchronousrequest nsurlsessiondatatask

使用以下方法进行反向地理编码,

[api getRequest:[NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/geocode/json?latlng=%f,%f&key=%@&language=%@",latV,lonV,kGoogleAPIKey,@"en"] withCompletionHandle:^(NSData *data) {

    NSMutableDictionary *returnedDict = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];

    NSLog(@"the data value returned %@",returnedDict);

这个链接对我来说并不起作用,总是说请求超时或其他错误,

很少能正确得到答案,

无法理解为什么会发生这种情况,iPhone 6中的一个以及iOS 9中的iPhone 6,有时会得到正确的响应,但有时我无法

有时会收到此错误

This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes.  This will cause an exception in a future release.
 Stack:(
    0   CoreFoundation                      0x0000000186304f74 <redacted> + 148
    1   libobjc.A.dylib                     0x000000019aefbf80 objc_exception_throw + 56
    2   CoreFoundation                      0x0000000186304ea4 <redacted> + 0
    3   Foundation                          0x000000018731e5d8 <redacted> + 88
    4   Foundation                          0x00000001871a0a1c <redacted> + 36
    5   UIKit                               0x000000018c0826a0 <redacted> + 884
    6   UIKit                               0x000000018c083b14 <redacted> + 788
    7   UIKit                               0x000000018c14ca6c <redacted> + 480
    8   UIKit                               0x000000018c149a44 <redacted> + 172
    9   UIKit                               0x000000018c149cb4 <redacted> + 96

10  UIKit                               0x000000018c14a178 <redacted> + 80
11  UIKit                               0x000000018c14e5c4 <redacted> + 492
12  UIKit                               0x000000018c14d878 <redacted> + 164
13  UIKit                               0x000000018c14d7a8 <redacted> + 284
14  UIKit                               0x000000018bcaa700 <redacted> + 444
15  UIKit                               0x000000018bcaa7d4 <redacted> + 60
16  UIKit                               0x000000018bcaa914 <redacted> + 28
17  UIKit                               0x000000018bca9f08 <redacted> + 100
18  UIKit                               0x000000018b85b610 <redacted> + 1124
19  UIKit                               0x000000018b85b194 <redacted> + 28
20  UIKit                               0x000000018bbcdbfc <redacted> + 108
21  UIKit                               0x000000018bbc6e58 <redacted> + 1328
22  UIKit                               0x000000018bbc8840 <redacted> + 4428
23  UIKit                               0x000000018bbcb278 <redacted> + 472
24  UIKit                               0x000000018b9520a4 <redacted> + 184
25  UIKit                               0x000000018c13d324 <redacted> + 512
26  UIKit                               0x000000018c13b8d8 <redacted> + 228
27  UIKit                               0x000000018bcb8328 <redacted> + 260
28  Mawgif                              0x0000000100177534 __63-[APIService_Request_Response getRequest:withCompletionHandle:]_block_invoke + 628
29  CFNetwork                           0x0000000185a1349c <redacted> + 32
30  CFNetwork                           0x0000000185a26454 <redacted> + 296
31  Foundation                          0x000000018722782c <redacted> + 16
32  Foundation                          0x000000018717a6c0 <redacted> + 96
33  Foundation                          0x000000018716a918 <redacted> + 604
34  Foundation                          0x0000000187229c20 <redacted> + 224
35  libdispatch.dylib                   0x0000000101ec5d30 _dispatch_client_callout + 16
36  libdispatch.dylib                   0x0000000101ed27f0 _dispatch_queue_drain + 1036
37  libdispatch.dylib                   0x0000000101ec9a20 _dispatch_queue_invoke + 464
38  libdispatch.dylib                   0x0000000101ed4908 _dispatch_root_queue_drain + 760
39  libdispatch.dylib                   0x0000000101ed4600 _dispatch_worker_thread3 + 132
40  libsystem_pthread.dylib             0x000000019b909478 _pthread_wqthread + 1092
41  libsystem_pthread.dylib             0x000000019b909028 start_wqthread + 4

0 个答案:

没有答案