Adding GMSMarker to GMSMapView Crashes on iPhone 6

I have some code that loads a map view and places a marker on it. I basically refactored my code as google example code to add GMSMarker. The app doesn't work in simulator (8.4), but when the marker code is added to the map on my iPhone 6 ( marker.map = mapView_

) the app crashes and I get an error in Xcode: EXC_BAD_ACCESS (code = 1, address = 0x0).

MapView is loaded on the phone when I remove a line of code marker.map = mapView_

. This is what I minified my code in viewDidLoad: below.

GMSCameraPosition *camera = [GMSCameraPosition cameraWithTarget:loc zoom:12.5];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];

mapView_.settings.myLocationButton = YES;
mapView_.settings.tiltGestures = NO;
mapView_.settings.rotateGestures = NO;
mapView_.delegate = self;

dispatch_async(dispatch_get_main_queue(), ^{
    mapView_.myLocationEnabled = YES;
});

self.view = mapView_;

GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = camera.target;
marker.snippet = @"Hello World";
marker.appearAnimation = kGMSMarkerAnimationPop;
marker.map = mapView_;

      

+3
ios iphone google-maps gmsmapview


source to share


No one has answered this question yet

See similar questions:

39
Adding google maps as sub-task crashes iOS app with exc_bad
3
Ios google maps showing multiple marker issues (info box and marker repeat)

or similar:

1141
How can I develop for iPhone using Windows development machine?
768
Can I embed my own font in the iPhone app?
428
Symbolic iPhone App Crash Reports
6
"isReachable" is incorrect when sending message from watch app to iOS app
4
GMSMarker not showing in 1.3
3
iOS Swift: How to check if an object exists in an array so I don't add it to it or create a GMSMarker with it?
1
Custom marker fragment does not invoke button action target
1
google map sdk ios 7 mylocationbutton disappears
1
An updated image is displayed after the Info Marker window
0
iOS GMSMapView changes the original loading background color



All Articles
Loading...
X
Show
Funny
Dev
Pics