Google Maps iOS sdks出现错误:在这种情况下,后台执行会崩溃

时间:2014-11-12 01:18:56

标签: ios google-maps mkmapview google-maps-sdk-ios ios-keyboard-extension

我正在尝试将地图添加到自定义键盘扩展程序中。在我尝试在键盘中添加MKMapView之后,当地图视图出现时我立即崩溃。所以我试图将谷歌地图添加到键盘。但运气不好,我收到了错误:

Terminating app due to uncaught exception 'GMSBackgroundAppException', reason: 'Background execution would crash in this scenario'

我从谷歌地图文档中复制了确切的代码,我在另一个空白项目中运行了这个代码,并且它有效。但它只是在自定义键盘扩展中不起作用。它给了我上面的错误。如果您仍想查看以下代码:

- (void)viewDidLoad {
    [super viewDidLoad];

    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_;
}

0 个答案:

没有答案