Google Maps iOS SDK崩溃 [英] Google Maps iOS SDK crash

查看:129
本文介绍了Google Maps iOS SDK崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用谷歌地图iOS SDK与故事板。

  @implementation MyViewController 
@synthesize btnMyLock;
@synthesize btnNearby;

GMSMapView * mapView_;
- (void)viewDidLoad
{
[super viewDidLoad];
//加载视图后通常从笔尖执行任何其他设置。
GMSCameraPosition * camera = [GMSCameraPosition cameraWithLatitude:20
longitude:20
zoom:0];

mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;

self.view = mapView_;
//在地图的中心创建一个标记。
GMSMarker * marker = [[GMSMarker alloc] init];
[marker setIcon:[UIImage imageNamed:@pin]];
marker.position = CLLocationCoordinate2DMake(-33.86,151.20);
marker.title = @悉尼;
marker.snippet = @澳大利亚;
marker.map = mapView_;

mapView_.settings.compassButton = YES;

[mapView_ addSubview:btnMyLock];
[mapView_ addSubview:btnNearby];
}

按钮btnMyLock推送表格视图控制器。在iOS 7中没关系。但iOS 6我的应用程序崩溃。有时使用EXC_BAD_ACCESS(code = 1)或code = 2崩溃

解决方案

使用Autolayout视图的问题。 b $ b

I use google maps iOS SDK with storyboard. Application starting with Navigation View Controller that has a Root View Controller with map.

@implementation MyViewController
@synthesize btnMyLock;
@synthesize btnNearby;

GMSMapView *mapView_;
- (void)viewDidLoad
{
    [super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:20
                                                        longitude:20
                                                             zoom:0];

     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 setIcon:[UIImage imageNamed:@"pin"]];
     marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
     marker.title = @"Sydney";
     marker.snippet = @"Australia";
     marker.map = mapView_;

     mapView_.settings.compassButton = YES;

     [mapView_ addSubview:btnMyLock];
     [mapView_ addSubview:btnNearby]; 
}

Button btnMyLock push the Table View Controller. In iOS 7 it's ok. But iOS 6 my app crashes. Sometimes crash with EXC_BAD_ACCESS (code=1) or code=2

解决方案

Problem that I used Autolayout view.

这篇关于Google Maps iOS SDK崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆