使用Xcode 7/iOS9无法使用Google Maps API在路径错误时加载优化模型

Der*_*son 6 google-places-api ios9 swift2

我正在尝试在我的代码中使用Google Places API自动填充功能.

    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)")
                }
            }
        })

    }
}
Run Code Online (Sandbox Code Playgroud)

当我运行它时,我收到此错误:有CoreData: Failed to load optimized model at path '/var/mobile/Containers/Bundle/Application/ 任何想法吗?

chi*_*tza 2

将-ObjC添加到“ Other Linker Flags

(Build Settings -> Linking -> Other Linker Flags). 
Run Code Online (Sandbox Code Playgroud)

这为我解决了这个问题。

添加此标志后,我收到一些有关缺少符号(例如_CBAdvertisementDataManufacturerDataKey)的错误。

我在 * 中添加了Accelerate和框架CoreBluetoothBuild Phases -> Link Binary With Libraries*.