Van*_*hta 10 google-maps ios google-places-api
我在我的一个屏幕上实现了谷歌的GMSPlacePickerViewController.
现在问题是在Android中他们正在显示包含所选位置和位置图像的确认框,如下所示,
在iOS中他们不是要求相同的,在iOS中我使用下面的代码,
// The code snippet below shows how to create and display a GMSPlacePickerViewController.
@IBAction func pickPlace(_ sender: UIButton) {
let config = GMSPlacePickerConfig(viewport: nil)
let placePicker = GMSPlacePickerViewController(config: config)
present(placePicker, animated: true, completion: nil)
}
// To receive the results from the place picker 'self' will need to conform to
// GMSPlacePickerViewControllerDelegate and implement this code.
func placePicker(_ viewController: GMSPlacePickerViewController, didPick place: GMSPlace) {
// Dismiss the place picker, as it cannot dismiss itself.
viewController.dismiss(animated: true, completion: nil)
print("Place name \(place.name)")
print("Place address \(place.formattedAddress)")
print("Place attributions \(place.attributions)")
}
func placePickerDidCancel(_ viewController: GMSPlacePickerViewController) {
// Dismiss the place picker, as it cannot dismiss itself.
viewController.dismiss(animated: true, completion: nil)
print("No place selected")
}
Run Code Online (Sandbox Code Playgroud)
我在上面的代码中遗漏了什么?