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

a 夏天 提交于 2019-12-07 02:26:52

问题


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?


回答1:


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*.




回答2:


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



来源:https://stackoverflow.com/questions/32671696/failed-to-load-optimized-model-at-path-error-with-google-maps-api-using-xcode-7

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