我在我的iOS应用程序中集成了Goole Map(v1.5),当我在调试模式下在真实设备(iPad 4 iOS 6.1)上测试时,它可以正常工作。
我发布了我的应用程序,当用户打开地图时,应用程序崩溃了。
我无法确定问题出在哪里以及为什么会崩溃。
崩溃报告:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x366333e2 __exceptionPreprocess + 158
1 libobjc.A.dylib 0x33b6695e objc_exception_throw + 26
2 CoreFoundation 0x36636dbc +[NSObject(NSObject) doesNotRecognizeSelector:] + 180
3 CoreFoundation 0x36635648 ___forwarding___ + 388
4 CoreFoundation 0x3658d204 _CF_forwarding_prep_0 + 20
5 myApp 0x00053286 -[ELocation loadView] (ELocation.m:45)
6 UIKit 0x309eb414 -[UIViewController loadViewIfRequired] + 64
7 UIKit 0x30a65f7c -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 80
8 UIKit 0x30a65f22 -[UITabBarController transitionFromViewController:toViewController:] + 26
9 UIKit 0x30a100a8 -[UITabBarController _setSelectedViewController:] + 292
10 UIKit 0x30b0569c -[UITabBarController _tabBarItemClicked:] + 268
11 UIKit 0x30ab703a -[UIApplication sendAction:to:from:forEvent:] + 66
12 UIKit 0x30ab6fee -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 26
13 UIKit 0x30b05564 -[UITabBar _sendAction:withEvent:] + 380
14 UIKit 0x30ab703a -[UIApplication sendAction:to:from:forEvent:] + 66
15 UIKit 0x30ab6fee -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 26
16 UIKit 0x30ab6fc8 -[UIControl sendAction:to:forEvent:] + 40
17 UIKit 0x30ab687e -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 498
18 UIKit 0x30ab703a -[UIApplication sendAction:to:from:forEvent:] + 66
19 UIKit 0x30ab6fee -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 26
20 UIKit 0x30ab6fc8 -[UIControl sendAction:to:forEvent:] + 40
21 UIKit 0x30ab687e -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 498
22 UIKit 0x30ab6d6c -[UIControl touchesEnded:withEvent:] + 484
23 UIKit 0x309df5bc -[UIWindow _sendTouchesForEvent:] + 520
24 UIKit 0x309cc8a4 -[UIApplication sendEvent:] + 376
25 UIKit 0x309cc1b2 _UIApplicationHandleEvent + 6194
26 GraphicsServices 0x365465f2 _PurpleEventCallback + 586
27 GraphicsServices 0x36546222 PurpleEventCallback + 30
28 CoreFoundation 0x366083e2 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 30
29 CoreFoundation 0x36608386 __CFRunLoopDoSource1 + 134
30 CoreFoundation 0x3660720a __CFRunLoopRun + 1378
31 CoreFoundation 0x3657a238 CFRunLoopRunSpecific + 352
32 CoreFoundation 0x3657a0c4 CFRunLoopRunInMode + 100
33 GraphicsServices 0x36545336 GSEventRunModal + 70
34 UIKit 0x30a20284 UIApplicationMain + 1116
35 myApp 0x0001277e main (main.m:16)
36 myApp 0x00012734 start + 36
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x33e32350 __pthread_kill + 8
1 libsystem_c.dylib 0x376aefb2 pthread_kill + 54
2 libsystem_c.dylib 0x376eb366 abort + 90
3 libc++abi.dylib 0x3144cdda abort_message + 70
4 libc++abi.dylib 0x3144a094 default_terminate() + 20
5 libobjc.A.dylib 0x33b66a58 _objc_terminate() + 144
6 libc++abi.dylib 0x3144a118 safe_handler_caller(void (*)()) + 76
7 libc++abi.dylib 0x3144a1b0 std::terminate() + 16
8 libc++abi.dylib 0x3144b626 __cxa_rethrow + 90
9 libobjc.A.dylib 0x33b669b0 objc_exception_rethrow + 8
10 CoreFoundation 0x3657a29c CFRunLoopRunSpecific + 452
11 CoreFoundation 0x3657a0c4 CFRunLoopRunInMode + 100
12 GraphicsServices 0x36545336 GSEventRunModal + 70
13 UIKit 0x30a20284 UIApplicationMain + 1116
14 myApp 0x0001277e main (main.m:16)
15 myApp 0x00012734 start + 36
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x33e225d0 kevent64 + 24
1 libdispatch.dylib 0x366c9d22 _dispatch_mgr_invoke + 806
2 libdispatch.dylib 0x366c5374 _dispatch_mgr_thread + 32
Thread 2:
0 libsystem_kernel.dylib 0x33e32d98 __workq_kernreturn + 8
1 libsystem_c.dylib 0x37686ad6 _pthread_workq_return + 14
2 libsystem_c.dylib 0x376867f2 _pthread_wqthread + 362
3 libsystem_c.dylib 0x37686680 start_wqthread + 4
Thread 3 name: WebThread
Thread 3:
0 libsystem_kernel.dylib 0x33e21e30 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x33e21fd0 mach_msg + 48
2 CoreFoundation 0x366082b6 __CFRunLoopServiceMachPort + 126
3 CoreFoundation 0x3660702c __CFRunLoopRun + 900
4 CoreFoundation 0x3657a238 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x3657a0c4 CFRunLoopRunInMode + 100
6 WebCore 0x3898aa58 RunWebThread(void*) + 440
7 libsystem_c.dylib 0x376910de _pthread_start + 306
8 libsystem_c.dylib 0x37690fa4 thread_start + 4
Thread 4:
0 libsystem_kernel.dylib 0x33e32d98 __workq_kernreturn + 8
1 libsystem_c.dylib 0x37686ad6 _pthread_workq_return + 14
2 libsystem_c.dylib 0x376867f2 _pthread_wqthread + 362
3 libsystem_c.dylib 0x37686680 start_wqthread + 4
Thread 5 name: Dispatch queue: com.apple.CoreLocation.ConnectionClient.0x1d8a3f90.events
Thread 5:
0 libsystem_kernel.dylib 0x33e21e98 semaphore_timedwait_trap + 8
1 libdispatch.dylib 0x366c8c16 _dispatch_semaphore_wait_slow + 118
2 CoreLocation 0x32b3a774 CLClientInvokeCallback(__CLClient*, CLClientEvent, objc_object*) + 340
3 CoreLocation 0x32b3ddd8 ___CLClientCreateConnection_block_invoke_0 + 384
4 CoreLocation 0x32b740b8 __setEventHandler_block_invoke_0 + 344
5 libxpc.dylib 0x32457804 _xpc_connection_mach_event + 768
6 libdispatch.dylib 0x366ca688 _dispatch_mach_msg_invoke + 120
7 libdispatch.dylib 0x366c7afa _dispatch_queue_drain + 78
8 libdispatch.dylib 0x366ca92e _dispatch_mach_invoke + 166
9 libdispatch.dylib 0x366c7afa _dispatch_queue_drain + 78
10 libdispatch.dylib 0x366c5678 _dispatch_queue_invoke + 40
11 libdispatch.dylib 0x366c7afa _dispatch_queue_drain + 78
12 libdispatch.dylib 0x366c5678 _dispatch_queue_invoke + 40
13 libdispatch.dylib 0x366c8610 _dispatch_root_queue_drain + 208
14 libdispatch.dylib 0x366c87d4 _dispatch_worker_thread2 + 88
15 libsystem_c.dylib 0x376867ee _pthread_wqthread + 358
16 libsystem_c.dylib 0x37686680 start_wqthread + 4
Thread 0 crashed with ARM Thread State (32-bit):
r0: 0x00000000 r1: 0x00000000 r2: 0x00000000 r3: 0x3ae97524
r4: 0x00000006 r5: 0x3ae97b78 r6: 0x1cdb5a24 r7: 0x2fdf0a34
r8: 0x1cdb5a00 r9: 0x00000300 r10: 0x00000000 r11: 0x00212bc4
ip: 0x00000148 sp: 0x2fdf0a28 lr: 0x376aefb7 pc: 0x33e32350
cpsr: 0x00000010
- (void)loadView {
_locationManager = [[CLLocationManager alloc] init];
_locationManager.desiredAccuracy = kCLLocationAccuracyBest;
_locationManager.delegate = self;
[_locationManager startUpdatingLocation];
_destLocation = nil;
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:_locationManager.location.coordinate.latitude longitude:_locationManager.location.coordinate.longitude zoom:12]; //**line 45**
mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView.settings.zoomGestures = YES;
mapView.settings.myLocationButton = YES;
mapView.myLocationEnabled = YES;
mapView.delegate = self;
self.view = mapView;
}
答案 0 :(得分:1)
当您拨打[_locationManager startUpdatingLocation]
时,如果某个位置可用,您将在稍后的某个时间点异步地通过locationManager:didUpdateLocations:
收到回叫。在此之前_locationManager.location
可能为零 - 尽管如果您的应用之前已缓存某个位置,则可能不会。
此可能是导致您之前未运行该应用的用户崩溃的原因,如第45行所示,您假设您有一个有效的位置来创建相机位置。虽然我不确定,因为在nil上调用.coordinate.latitude
应该只返回0而不是崩溃。
可能会提示您的用户访问其位置,并且在他们回答“是”之前尝试访问该位置是造成崩溃的原因。要在您自己的设备上重现这一点,您需要重置您的位置&隐私设置。通过设置 - >执行此操作一般 - >重置 - >重置位置&隐私。不幸的是,这会将其重置为您的所有应用程序以及所有隐私选项(即位置,照片,联系人等)。即使您删除并重新安装您的应用程序,iOS也会记住您之前已回答“是”。更简单的方法可能是尝试暂时更改您的捆绑包ID,但您还需要获取新的Google地图密钥。
答案 1 :(得分:0)
请记住,此SDK是iOS 6.0及更高版本。崩溃可能发生在较旧的iOS设备上吗?