user5936834
user5936834

Reputation:

Missing Map, only marker is visible

I am having a hard time trying to figure out what is going wrong. I have gone through similar questions on SO, but the solutions mentioned here did not work. One of the popular solution was to enable the 'Google Maps SDK for iOS', however it was already enabled in my case: enter image description here

I think I have taken care of everything mentioned in the tutorial by Google, but when I run my app in simulator, this happens :

enter image description here

Then I checked my console to find this: enter image description here

I checked my bundle ID to what I entered while generating the key and it's correct, also the key entered in AppDelegate.m isn't wrong. Can someone help me with this. Thanks in advance.

AppDelegate.m :

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[GMSServices provideAPIKey:@"MY-KEY"]; 

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = [[ViewController alloc] init];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];

return YES;
}

ViewController.m:

- (void)viewDidLoad {
[super viewDidLoad];

GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
                                                        longitude:151.20
                                                             zoom:6];
GMSMapView *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.position = CLLocationCoordinate2DMake(-33.86, 151.20);
marker.title = @"Sydney";
marker.snippet = @"Australia";
marker.map = mapView;
[self.view layoutIfNeeded];
}

Upvotes: 1

Views: 1337

Answers (3)

Waqas Khalid Obeidy
Waqas Khalid Obeidy

Reputation: 676

I faced the similar issue and fixed it by generating and enabling the right APIKey for iOS (and not javascript or android) using this link -- APIKey for iOS

Upvotes: 0

Arpit Dongre
Arpit Dongre

Reputation: 1713

Here are few things you can try:

  1. Include curly braces. For some people it worked:

[GMSServices provideAPIKey:@"{MY-KEY}"];

  1. Manually type the API key instead of copying & pasting the key. Sometimes some characters differs in copy paste procedure.

  2. If nothing works, make a fresh start.

Upvotes: 0

Siva Sankar
Siva Sankar

Reputation: 553

once again check your google service key that is valid key are not. key is not valid map is not showed.

[GMSServices provideAPIKey:@"AIzaSyXXXXXXXXXXXXXXXXXXXXXX"];

Upvotes: 2

Related Questions