我正在尝试在我的代码中使用 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)")
}
}
})
}
}
当我运行它时,我收到此错误:
CoreData: Failed to load optimized model at path '/var/mobile/Containers/Bundle/Application/
有任何想法吗?
最佳答案
添加 -ObjC 到“Other Linker Flags
”
(Build Settings -> Linking -> Other Linker Flags).
这为我解决了它。
添加此标志后,我收到了一些关于缺少符号的错误(例如 _
CBAdvertisementDataManufacturerDataKey
)。我添加了
Accelerate
和 CoreBluetooth
* 中的框架 Build Phases -> Link Binary With Libraries*.
关于google-places-api - 无法使用 Xcode 7/iOS9 使用 Google Maps API 在路径错误时加载优化模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32671696/