-1

Throwing following error when trying to get current location on iOS version 11.2.6 but works on versions < 11.

CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/386576ED-732A-4DBD-9E94-AD005A83021A/App.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileVersionID.omo'

D.Ahmed
  • 1
  • 1

2 Answers2

0

Just update your Podfile

pod 'GoogleMaps'
pod 'GooglePlaces'

Also try a clean build! Try-

  1. cmd + k
  2. cmd + alt + cmd + k
  3. cmd + shift + B
Rashed
  • 2,349
  • 11
  • 26
  • not working Still same error CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/257BDA41-4AA7-4E43-B975-6B6B0B4FD20B/App4Cab.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileVersionID.omo' – D.Ahmed Mar 27 '18 at 13:32
  • Did u update your pods? did u check when you run ur app your api gets a request? – Rashed Mar 27 '18 at 13:33
  • yes i was update my pods and code running on ipad version 10.3.3 but ios 11 nor support – D.Ahmed Mar 27 '18 at 13:37
  • Your api getting any request???? Tell me on thing - did u restrict your place api for only iOS or left it open.And did u set Privacy - Location When In Use Usage Description? ..in your info.plish – Rashed Mar 27 '18 at 13:40
  • Application restrictions "None" api restrictions "None" and yes i was set Location When In Use Usage Description in info.plist – D.Ahmed Mar 27 '18 at 13:51
  • need to see your full code – Rashed Mar 27 '18 at 15:44
0

This code is working fine with ios < 11

import GoogleMaps

define delegate CLLocationManagerDelegate

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

    self.locationManager.requestAlwaysAuthorization()
    self.locationManager.requestWhenInUseAuthorization()
    self.locationManager.delegate = self
    self.locationManager.startUpdatingLocation()

    return true
}


func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {

    let objLAt = manager.location?.coordinate.latitude
    let objLong = manager.location?.coordinate.longitude

    print(objLAt)
    print(objLong)
}
AtulParmar
  • 4,358
  • 1
  • 24
  • 45