Google Maps iOS sdks get error: Background execution would crash in this scenario

432 views Asked by At

I am trying to add a map to my custom keyboard extension. After I tried to add MKMapView in the keyboard, I get immediately crash when the map view showed up. So I am trying to add google map to the keyboard. But out of luck, I am getting error:

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

I copied the exact code from google maps documentation, and I ran this code in another blank project, and it worked. But it just won't work in the custom keyboard extension. It gives me the error above. If you still want to see the code below:

- (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

There are 0 answers