I am using GoogleMap SDK in iOS to display user's current location. Google map is showing on my view but marker is not visible. I don't know what I am doing wrong here.
Here is my code
#import <GoogleMaps/GoogleMaps.h>
@interface firstViewController () {
// GMSMapView *mapView_;
IBOutlet GMSMapView *mapView_;
}
@end
@implementation firstViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Create a GMSCameraPosition that tells the map to display the
// coordinate -33.86,151.20 at zoom level 6.
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
longitude:151.20
zoom:6];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = NO;
[self.view addSubview: 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_;
}
Why are you setting your map with CGRectZero frame??
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = NO;
[self.view addSubview: mapView_];
The map will not be visible if you set it's frame to CGRectZero. So first, try making your mapView visible by giving it a different frame.