iosxcodegoogle-maps-sdk-ios

Why is Google Maps iOS SDK crashing my app?


Here is the output I get with the error Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)

CoreData: annotation:  Failed to load optimized model at path '/var/containers/Bundle/Application/57E1066F-07A5-4A41-B1AF-2B88F6B8300A//GoogleMaps.bundle/GMSCacheStorage.momd/Storage.omo'
CoreData: annotation:  Failed to load optimized model at path '/var/containers/Bundle/Application/57E1066F-07A5-4A41-B1AF-2B88F6B8300A/.app/GoogleMaps.bundle/GMSCacheStorage.momd/Storage.omo'
CoreData: annotation:  Failed to load optimized model at path '/var/containers/Bundle/Application/57E1066F-07A5-4A41-B1AF-2B88F6B8300A/.app/GoogleMaps.bundle/GMSCacheStorage.momd/Storage.omo'
2018-09-18 11:18:28.144990-0500 [7976:1906621] [framework] CUIThemeStore: No theme registered with id=0
2018-09-18 11:18:28.331857-0500 [7976:1906844] ((null)) was false: Cannot find image polyline_colors_texture_dim
2018-09-18 11:18:28.331887-0500 [7976:1906844] ((null)) was false: Image data can't be NULL.
2018-09-18 11:18:28.331900-0500 [7976:1906844] ((null)) was false: Invalid texture state for routesDimTextureState.

I'm running iOS 12 SDK, on an iPhone X device and simulator.

It seems the way to reproduce it in my app is to build and run the app. Usually the map works fine at this point. Then I stop the running, and re-run it. Then when I try to load the map, I get this error with a crash. If

I've tried this on multiple versions of GoogleMaps using cocoapods, including the latest one.

I also know that this is an ongoing issue for the CoreData annotation, but I believe it is the last three lines that are crashing the app.

Also, I have a verified API Key, and iOS SDK is enabled. I am still using a transitional billing account though, but not sure if that is relevant.

UPDATE: I downloaded Xcode 9.4 and I do no have this issue. The Core Data annotations are still there, but no crash.

UPDATE #2: I have found a work around. I believe this is caused by Xcode 10s new Build System. With Xcode window in focus, got to File -> Workspace Settings... -> Choose Legacy Build System.

I ended up digging through the assembly and found the path to the file it could NOT find. I went there, and the image is there. So either Google Maps bundle is configured incorrectly, or this is a bug with Cocoa Pods, or idk what.


Solution

  • Ok. The reason it was crashing was because a previous developer had installed GMAPS SDK manually and did not remove it when switching to cocoapods. I fixed it by opening the Frameworks folder that's inside of my apps project (not the one inside of Pods) and deleting all the google maps stuff. And now it works with the new Xcode 10 build system.