Google Static Maps API not returning any data

576 views Asked by At

Im trying to use the Google Static Maps API but it's not returning anything. The API key is correct and I am successfully using the Google Places API. IDK what I'm doing wrong. I've tried using only the required parameters and nothing. I've also tried using an example URL from the API Docs and nothing either.

NSString *url = [NSString stringWithFormat:@"http://maps.googleapis.com/maps/api/staticmap?zoom=18&size=320x120&visual_refresh=true&markers=size:mid|color:0x00AB8B|%f,%f&key=AIzaSyDbg7wrSq-USEJWUqf5TOPepbtGRwbYtg8", [LocationController sharedSingleton].locationManager.location.coordinate.latitude, [LocationController sharedSingleton].locationManager.location.coordinate.longitude];

NSURL *googleURL = [NSURL URLWithString:[url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];

      dispatch_async(kBgQueue, ^{
           NSData* data = [NSData dataWithContentsOfURL: googleURL];
           NSLog(@"data size: %lu", (unsigned long)[data length]);
           if (data.length != 0){
               [mapViewArray addObject:data];
           }
      });
1

There are 1 answers

0
david2391 On

Figured it out. Was missing the required "sensor" param