我的屏幕图像 我想显示带有地点选择器的地图。我创建了所需的 API,并将它们添加到我的 AppDelegate.m 中。然后我在我的视图控制器中实现了这段代码:
- (void)location
{
GMSPlacePickerConfig *config = [[GMSPlacePickerConfig alloc] initWithViewport:nil];
GMSPlacePickerViewController *placePicker = [[GMSPlacePickerViewController alloc] initWithConfig:config];
placePicker.delegate = self;
[self presentViewController:placePicker animated:YES completion:nil];
}
- (void)placePicker:(GMSPlacePickerViewController *)viewController didPickPlace:(GMSPlace *)place {
[viewController dismissViewControllerAnimated:YES completion:nil];
NSLog(@"Place name %@", place.name);
NSLog(@"Place address %@", place.formattedAddress);
NSLog(@"Place attributions %@", place.attributions.string);
}
- (void)placePickerDidCancel:(GMSPlacePickerViewController *)viewController {
[viewController dismissViewControllerAnimated:YES completion:nil];
NSLog(@"No place selected");
}
我得到 GMSPlacePickerViewController 但在我的引脚下没有地图。有任何想法吗?