Search code examples
iosiphoneobjective-cgoogle-mapsgoogle-maps-sdk-ios

Google Maps iOS SDK crash


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


Solution

  • Problem that I used Autolayout view.