Failed to load optimized model - GoogleMaps SDK IOS

无人久伴 提交于 2019-11-28 08:07:45

If you have already double-checked the basic setup for the "google maps ios-sdk" with an APIkey for your app's bundle identifier here and still have the same problem then probably you have not enabled the google maps API. Go to your app-project's dashboard on https://console.developers.google.com and click the "ENABLE APIS AND SERVICES". There, under the MAPS section select "the Google maps sdk for ios" and enable it.

  1. Selecte [APP-NAME].app and show it in finder and show package contents.
  2. You will see GoogleMaps.bundle, right click and show it's package contents.
  3. Enter GMSCacheStorage.momd folder.
  4. Delete StorageWithTileProto.omo.

After that those errors disappeared.

Som Parkash

Expand GoogleMaps.bundle from Project Navigator(in Xcode) then expand GMSCacheStorage.momd folder. Now delete StorageWithTileProto.omo file from this folder and run project again.

I just run into another issue with same warnings. The map was working fine but there were few warnings in the console. I googled around and found this solution.

  1. Go to products group in your project navigator and select your [APP-NAME].app and then show in finder and choose show package contents

  2. Now you will see your [APP-NAME].momd folder. Open it there you will see your [APP-NAME].omo

  3. Move [APP-NAME].omo to Trash and run the project again

  4. Log message should not be displaying in console now.

Note: Don't delete any .mom files

Take a look at this link about the errors which sometimes result in crashes in GoogleMaps SKD 2.4 and 2.5 including in my case (2.5):

https://issuetracker.google.com/issues/64504919

Also try:

Command + Shift + B

I know, it might sound silly but I spent HOURS and this was what finally solved my issue! A CLEAN BUILD After all!

Some people experiencing the same issue suggested downgrading the SDK to 2.3, I did that and results were the same and also my code was crashing all the time so I had to update back to 2.5

I had this problem. I just forgot to add view = mapView. add this to your viewDidLoad :

override func viewDidLoad(){
super.viewDidLoad()
view = mapView
mapView?.delegate = self
let camera = GMSCameraPosition.camera(withLatitude : 0.0 , longitude : 0.0, zoom :6.0)
mapView = GMSMapView.map(withFrame : CGRect.zero , camera : camera)

}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!