Search code examples
iosiphoneipadgoogle-mapsgoogle-maps-sdk-ios

app is crashing without any error


I am trying to integrate the google map sdk and followed this link to start from google. I have created the API key and used it in appDelegate. I wrote below code in my ViewController.m and I have imported all the frameworks required, and also put the -ObjC in other linker flag but still the app is crashing on run time. I have used breakpoints but no log is been shown up. Below is the entire code and haven't used any outlet.

 #import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
                                                            longitude:151.20 zoom:6];
    mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera]; // crashing here, even gave different frames rather CGRectZero
    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_;
}

@end

DEMO SAMPLE LINK


Solution

  • I downloaded the code and run it. It works perfectly well. Just remove the old app and clear the target. Re-install the app. It should work fine.