Search code examples
iosswiftxcodegoogle-maps-sdk-ios

CoreData: annotation: Failed to load optimized model at path 'Users/~/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo'


I'm getting an error when opening loading the map view in my iOS app. The map view loads fine and appears on screen, however it does not load to the location I set when I initialized the map view.

Here is my code I used to implement the map view:

@IBOUTLET weak var mapView: UIView!

override viewDidLoad() {
    let camera = GMSCameraPosition.camera(withLatitude: lat!, longitude: long!, zoom: 10)
    mapView = GMSMapView.map(withFrame: mapView.frame, camera: camera)
}

This appears whenever the app loads the view controller with the map view:

CoreData: annotation: Failed to load optimized model at path '/Users/johnrendleman/Library/Developer/CoreSimulator/Devices/D9D3A943-E0B4-4DE2-8120-A6E9AE3B3F88/data/Containers/Bundle/Application/934980AB-F8E4-4214-8435-9E684AF58C87/ChapelHillTransit.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo' CoreData: annotation: Failed to load optimized model at path '/Users/johnrendleman/Library/Developer/CoreSimulator/Devices/D9D3A943-E0B4-4DE2-8120-A6E9AE3B3F88/data/Containers/Bundle/Application/934980AB-F8E4-4214-8435-9E684AF58C87/ChapelHillTransit.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo' CoreData: annotation: Failed to load optimized model at path '/Users/johnrendleman/Library/Developer/CoreSimulator/Devices/D9D3A943-E0B4-4DE2-8120-A6E9AE3B3F88/data/Containers/Bundle/Application/934980AB-F8E4-4214-8435-9E684AF58C87/ChapelHillTransit.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo'

Things I have already tried:

  • Clean build.
  • Updating the pod repo and pod (Google Maps & Places API for iOS 2.7.3
  • Updating XCode (9.4.1)
  • Regenerating API key with appropriate bundle identifier restrictions
  • Ensuring that my APIs are enabled on the Google Developer Console

Anyone know of a fix?


Solution

  • I just spent 5 hours with the same problem. Sometimes the map would show up and sometimes it would not. In the end, I found out I had a problem with my key. I accidentally deleted its permission to iOS. Some emulators were showing the map because they had the key cached. And some others were displaying the "StorageWithTileProto" error, because they had the tiles cached with the old key but no authorization do show it. I would recommend anyone with the "StorageWithTileProto" to test it with a new unrestricted key and to fully delete the app from the device/emulator before testing it. This might solve your problem as well.