場所ピッカープレイスピッカーの文書コードをSwift 3に変換する方法は?
@IBAction func pickPlace(sender: UIBarButtonItem) {
let center = CLLocationCoordinate2DMake(51.5108396, -0.0922251)
let northEast = CLLocationCoordinate2DMake(center.latitude + 0.001, center.longitude + 0.001)
let southWest = CLLocationCoordinate2DMake(center.latitude - 0.001, center.longitude - 0.001)
let viewport = GMSCoordinateBounds(coordinate: northEast, coordinate: southWest)
let config = GMSPlacePickerConfig(viewport: viewport)
placePicker = GMSPlacePicker(config: config)
placePicker?.pickPlaceWithCallback({ (place: GMSPlace?, error: NSError?) -> Void in
if let error = error {
print("Pick Place error: \(error.localizedDescription)")
return
}
if let place = place {
print("Place name \(place.name)")
print("Place address \(place.formattedAddress)")
print("Place attributions \(place.attributions)")
} else {
print("No place selected")
}
})
}
Place Picker in Swift 2 in Doucmentation of Google Map
スウィフト3に
placePicker?.pickPlace(callback: { (place: GMSPlace!, error: NSError!) -> Void in
if let error = error {
print("Pick Place error: \(error.localizedDescription)")
return
}
if let place = place {
}
} as! GMSPlaceResultCallback)
を変換し、不正な命令アクセスエラーに
Swift 3でこれを使用しているときに直面しているエラーは何ですか? – Wolverine
}として! GMSPlaceResultCallback) –
これは私にコールバックを変換させたいのですが、実行時に不正アクセスアクセスエラーが発生します –