【发布时间】:2015-03-02 08:50:41
【问题描述】:
我可能遗漏了一些东西,但我按照Google Maps SDK for iOS Site 中指示的步骤操作,但到目前为止我还没有成功。我尝试运行他们在页面底部的示例代码,但我的编译器一直在用未捕获的异常困扰我。
这是我的实现:
@implementation ViewController {
GMSMapView *mapView_;
}
在 viewDidLoad 中紧随其后:
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
longitude:151.20
zoom:6];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
self.view = mapView_;
// Creates a marker in the center of the map.
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
marker.title = @"Sydney";
marker.snippet = @"Australia";
marker.map = mapView_;
我确实包含了行:
[GMSServices provideAPIKey:@"API Key"];
并用我的实际 API 密钥替换 API 密钥字符串。然而我在编译时得到了这个。
我使用了一个断点,异常似乎是在执行这一行时产生的:
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
非常感谢您的任何帮助。
【问题讨论】:
标签: ios objective-c xcode google-maps