小编def*_*fou的帖子

谷歌地图iOS +故事板+ Segue =崩溃

我在我的应用程序中做的是:

我将一些数据加载到核心数据中,当完成时,应用程序需要转到下一个视图(谷歌地图)

[self performSegueWithIdentifier:@"loadMap" sender:self];

但是我得到了这个错误

Terminating app due to uncaught exception 'GMSThreadException', reason: 'All calls to the Google Maps SDK for iOS must be made from the UI thread'

如果我做所有这一切,但通过点击按钮做一个segue一切正常.

storyboard中的Google地图视图控制器有一个带有初始化代码的GMSMapView视图插座

GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:45.331875
                                                            longitude:14.450455
                                                                 zoom:14];

    self.mapView.camera = camera;

    GMSMarker *marker = [[GMSMarker alloc] init];
    marker.position = camera.target;
    marker.title = @"Test title";
    marker.snippet = @"Lorem ipsum...";
    marker.map = self.mapView;
Run Code Online (Sandbox Code Playgroud)

有人可以帮我吗?如何使用故事板以编程方式加载谷歌地图的视图控制器?

iphone google-maps ios uistoryboardsegue

1
推荐指数
1
解决办法
2565
查看次数

标签 统计

google-maps ×1

ios ×1

iphone ×1

uistoryboardsegue ×1