发布到 App Store 后,适用于 iOS 的 Google Maps SDK 崩溃
Posted
技术标签:
【中文标题】发布到 App Store 后,适用于 iOS 的 Google Maps SDK 崩溃【英文标题】:Google Maps SDK for iOS crash after publishing to App Store 【发布时间】:2013-12-18 15:32:30 【问题描述】:我的 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
ELocation.m 加载视图:
- (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;
【问题讨论】:
您是否尝试过自己从 App Store 下载并测试并抓取堆栈跟踪? 您是否已将调试 API 密钥更改为发布密钥? @GeorgeMitchell 是的,我做到了.. 请检查我编辑的问题。 @TussLászló 是否有适用于 iOS 的发布 API 密钥?我遵循了 Google 文档,没有任何关于发布 API 密钥的文章 【参考方案1】:当您调用[_locationManager startUpdatingLocation]
时,您将在某个位置可用时通过locationManager:didUpdateLocations:
收到回调,稍后将异步接收。在此之前,_locationManager.location
可能为 nil - 尽管如果您的应用之前缓存了一个位置,则可能不是。
这可能是您之前未运行过该应用程序的用户崩溃的原因,因为在第 45 行,您假设您有一个有效的位置来创建相机位置。虽然我不确定,因为在 nil 上调用 .coordinate.latitude
应该只返回 0 而不是崩溃。
可能是系统提示您的用户访问他们的位置,并且在他们回答“是”之前尝试访问该位置是导致崩溃的原因。要在您自己的设备上重现该内容,您需要重置您的位置和隐私设置。通过设置 -> 常规 -> 重置 -> 重置位置和隐私来执行此操作。不幸的是,这会为您的所有应用程序和所有隐私选项(即位置、照片、联系人等)重置它。即使您删除然后重新安装应用程序,iOS 也会记住您之前的回答是肯定的。一种更简单的方法可能是尝试临时更改您的捆绑包 ID,但您还需要获取新的 Google 地图密钥。
【讨论】:
感谢我设法解决了我的问题,看起来我忘记将 CoreLocation.framework 添加到我的项目中,尽管我不知道为什么它在没有它的情况下在两个设备和模拟器上的调试模式下都能正常工作。 【参考方案2】:请记住,此 SDK 是 iOS 6.0 及更高版本。崩溃是否发生在较旧的 iOS 设备上?
【讨论】:
是的,我知道,我的部署目标是 iOS 6.0。我在 iOS 6 和 7 上测试过,但仍然崩溃以上是关于发布到 App Store 后,适用于 iOS 的 Google Maps SDK 崩溃的主要内容,如果未能解决你的问题,请参考以下文章
firebase react-native 推送通知适用于 iOS 发布版本,但不适用于通过 App Store 发布的应用程序
仅适用于 iPhone 5/5s 和 iPhone 6/6+ 将应用程序提交到 App Store [重复]