Google PlaceAutoCompleteメソッドを使用して、textFieldに入力されたAddessの提案を取得しています。Google Autocomplete関数の呼び出し後にクラッシュする
func placeAutocomplete(text:String) {
let placesClient = GMSPlacesClient()
let filter = GMSAutocompleteFilter()
filter.type = .Address
placesClient.autocompleteQuery("New Delhi", bounds: nil, filter: nil) { (results, error) in
guard error == nil else {
print("Autocomplete error \(error)")
return
}
self.addressArray.removeAll()
for result in results! {
self.addressArray.append(result.attributedFullText.string)
print("Result \(result.attributedFullText.string) with placeID \(result.placeID)")
}
}
}
私はこのメソッドを呼び出します。クラッシュすると、次のようなエラーが表示されます。
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary boolValue]: unrecognized selector sent to instance 0x7fe338f01e40'
例外ブレークポイントを使用しようとしましたが、動作しません。 私はどこが間違っているのでしょうか?
Googleが現在提案しているもの(https://developers.google.com/places/ios-api/autocomplete#call_gmsplacesclient)にコードを変更すると、それはまだクラッシュですか? addressArrayとエラー:NSError?に何も追加せずに、まったく同じコードを試してください。一度これを試してみると、それが失敗した場合は私に知らせてください。 –
はい。それはオートコンプリート用のGoogleコードを使用してもクラッシュしています –