在模拟器中与地图交互时出错

时间:2017-09-13 08:37:36

标签: swift google-maps

帮助 有一个错误:

2017-09-13 11:21:04.405 Seer[1413:69626] *** Terminating app due to 
uncaught exception 'GMSThreadException', reason: 'The API method must 
be called from the main thread'
*** First throw call stack:
(
0   CoreFoundation                      0x000000010bb30b0b __exceptionPreprocess + 171
1   libobjc.A.dylib                     0x000000010aef2141 objc_exception_throw + 48
2   CoreFoundation                      0x000000010bb99625 +[NSException raise:format:] + 197
3   Seer                                0x0000000104638ed2 -[GMSMapView clear] + 97
4   Seer                                0x000000010461a4ff _TFC4Seer14ViewController12markercreatefT_T_ + 159
5   Seer                                0x000000010461950f _TFFC4Seer14ViewController9outputphpFT_T_U_FTGSqV10Foundation4Data_GSqCSo11URLResponse_GSqPs5Error___T_ + 2927
6   Seer                                0x00000001046178db _TTRXFo_oGSqV10Foundation4Data_oGSqCSo11URLResponse_oGSqPs5Error____XFdCb_dGSqCSo6NSData_dGSqS1__dGSqCSo7NSError___ + 203
7   CFNetwork                           0x000000010b3bd87b __75-[__NSURLSessionLocal taskForClass:request:uploadFile:bodyData:completion:]_block_invoke + 19
8   CFNetwork                           0x000000010b3bd095 __49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke + 143
9   Foundation                          0x000000010a9fc3b7 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7
10  Foundation                          0x000000010a9fc0bb -[NSBlockOperation main] + 101
11  Foundation                          0x000000010a9fa877 -[__NSOperationInternal _start:] + 627
12  Foundation                          0x000000010a9f65fc __NSOQSchedule_f + 198
13  libdispatch.dylib                   0x000000010caa905c _dispatch_client_callout + 8
14  libdispatch.dylib                   0x000000010ca8794f _dispatch_queue_serial_drain + 221
15  libdispatch.dylib                   0x000000010ca88669 _dispatch_queue_invoke + 1084
16  libdispatch.dylib                   0x000000010ca8aec4 _dispatch_root_queue_drain + 634
17  libdispatch.dylib                   0x000000010ca8abef _dispatch_worker_thread3 + 123
18  libsystem_pthread.dylib             0x000000010ce405a2 _pthread_wqthread + 1299
19  libsystem_pthread.dylib             0x000000010ce4007d start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type 
NSException
(lldb) 

在模拟器中与地图交互时,例如创建标记时:

let marker = GMSMarker()
            marker.position = CLLocationCoordinate2D(latitude: catlatlon[index][1], longitude: catlatlon[index][2])
            marker.title = "Муляж Камеры | ID: \(Int(catlatlon[index][3]))"
            marker.snippet = "Дата: \(catstring[index])"
            marker.icon = self.imageWithImage(image: #imageLiteral(resourceName: "ic_fake.png"), scaledToSize: CGSize(width: 28.0, height: 48.0)) // муляж камеры
            marker.map = self.mMap

但在真实的设备上,一切运作良好。 我会保持原样。但是我害怕当主持人在AppStore上测试应用程序时,会显示这个错误并且他们不会发布我的应用程序

0 个答案:

没有答案