I have Goole Map (v1.5) integrated in my iOS App and it works fine when I test it on a real device (iPad 4 iOS 6.1) in Debug mode.
I published my App and when users open the map the application crashes.
I cannot figure where the problem is and why does it crash.
Crash Report:
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;
}
When you call [_locationManager startUpdatingLocation]
then you will receive a callback via locationManager:didUpdateLocations:
when a location is available, asynchronously at some later point. Until then _locationManager.location
may be nil - although it might not be if your app has previously cached a location.
This might be the cause of your crash for users who've not run the app before, as on line 45 you're assuming you have a valid location to create the camera position at. Although I'm not sure, since calling .coordinate.latitude
on nil should just return 0 instead of crashing.
It may be that your users are being prompted for access to their location, and that attempting to access the location before they've answered yes is what is causing the crash. To reproduce that on your own device you'll need to reset your location & privacy settings. Do this via Settings -> General -> Reset -> Reset Location & Privacy. Unfortunately this resets it for all of your apps and for all of your privacy options (ie location, photos, contacts, etc). Even if you delete and then reinstall your app, iOS will remember that you've previously answered yes. An easier way might be to try temporarily changing your bundle ID, but then you'll also need to get a new Google maps key.
Remember this SDK is iOS 6.0 and greater. Could the crashes be on older iOS devices?
User contributions licensed under CC BY-SA 3.0