Google의 웹 사이트에 Places API 자습서를 읽었으며 iOS 용 Places API가 사용 설정되었으며 API 키가 내 AppDelegate에 있다는 것을 두 번 확인했습니다. 내 수업에서 GMSPlacePickerViewControllerDelegate를 구현했습니다. 장소 선택 도구가 열리고 장소를 볼 수 있으며 그 위에 탭할 수 있으며 검색 할 수 있습니다. 이 화면에서 벗어날 수 없으며 취소 할 수 없으며 실제로 아무것도 선택하거나 위치를 반환 할 수 없습니다. 이것은 실제 장치와 시뮬레이터에서 동일합니다. 왜 작동하지 않으며 어떻게 작동시킬 수 있습니까?iOS 용 Google Places API로 취소 또는 선택 취소 허용 안함
@IBAction func selectLocationPressed(_ sender: Any) {
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")
}
을 설정! 감사 – markeh21