2013-12-09 47 views
0

我試圖使用谷歌靜態地圖API,但它沒有返回任何東西。 API密鑰正確,我成功使用Google Places API。 IDK我做錯了什麼。我試過只使用所需的參數,沒有任何東西。我也嘗試使用來自API文檔的示例網址,但也沒有提供。谷歌靜態地圖API不返回任何數據

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]; 
      } 
     }); 

回答

0

想通了。缺少所需的「傳感器」參數

相關問題