我将 google maps iOS SDK 与 Storyboard一起使用。以导航 View Controller 开始的应用程序具有带 map 的 Root View Controller 。
@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];
}
按钮 btnMyLock 推送 TableView Controller 。在 iOS 7 中没问题。但是 iOS 6 我的应用程序崩溃了。有时会因 EXC_BAD_ACCESS (code=1) 或 code=2 而崩溃
最佳答案
我使用自动布局 View 的问题。
关于ios - 谷歌地图 iOS SDK 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19584955/