Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to load optimized model at path error with Google Maps API using Xcode 7 / iOS9

I am trying to use the Google Places API autocomplete feature in my code.

    import UIKit
import GoogleMaps

class ViewController: UIViewController, GMSMapViewDelegate {

    var placesClient: GMSPlacesClient?

    override func viewDidLoad() {
        super.viewDidLoad()

        placesClient = GMSPlacesClient()

        let filter = GMSAutocompleteFilter()
        filter.type = GMSPlacesAutocompleteTypeFilter.City
        placesClient?.autocompleteQuery("Pizza", bounds: nil, filter: filter, callback: { (results, error: NSError?) -> Void in
            if let error = error {
                print("Autocomplete error \(error)")
            }

            for result in results! {
                if let result = result as? GMSAutocompletePrediction {
                    print("Result \(result.attributedFullText) with placeID \(result.placeID)")
                }
            }
        })

    }
}

When I run it I am getting this error: CoreData: Failed to load optimized model at path '/var/mobile/Containers/Bundle/Application/ Any ideas?

like image 530
Derek Dawson Avatar asked Sep 19 '15 18:09

Derek Dawson


2 Answers

Add -ObjC to "Other Linker Flags"

(Build Settings -> Linking -> Other Linker Flags). 

This solved it for me.

After I added this flag I received some errors regarding missing symbols (such as _CBAdvertisementDataManufacturerDataKey).

I added the Accelerate and CoreBluetooth frameworks in *Build Phases -> Link Binary With Libraries*.

like image 114
chitza Avatar answered Nov 14 '22 12:11

chitza


This issue is fixed in the new update of Google maps https://developers.google.com/maps/documentation/ios-sdk/releases?hl=en Check this Link and update your local repositories

like image 1
Masroor Avatar answered Nov 14 '22 10:11

Masroor