-1
朋友你好 谷歌地圖-SDK位置的谷歌地圖上獲取由地方一系列
我是新來的ios和谷歌MAP-SDK的工作。並且一切都進行得很順利,但我無法在這種情況下使用註釋,因爲我無法找到我從Google的placeAPI獲取的位置。 因此,善待我的錯誤。
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~
代碼文件
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
-(IBAction)search:(id)sender
{
NSString *url = [NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/search/json?location=30.7343000,76.7933000&radius=500&types=food&name&sensor=true&key=AIzaSyCGeIN7gCxU8baq3e5eL0DU3_JHeWyKzic"];
//Formulate the string as URL object.
NSURL *googleRequestURL=[NSURL URLWithString:url];
// Retrieve the results of the URL.
dispatch_async(kBgQueue, ^{
NSData* data = [NSData dataWithContentsOfURL: googleRequestURL];
[self performSelectorOnMainThread:@selector(fetchedData:) withObject:data waitUntilDone:YES];
});
}
- (void)fetchedData:(NSData *)responseData {
//parse out the json data
NSError* error;
NSDictionary* json = [NSJSONSerialization
JSONObjectWithData:responseData
options:kNilOptions
error:&error];
//The results from Google will be an array obtained from the NSDictionary object with the key "results".
NSArray* places = [json objectForKey:@"results"];
//Write out the data to the console.
NSLog(@"Google Data: %@", places);
}
~~~~~~~~~~~~ 〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜
這裏是我將從中收回數據的代碼,並且希望在googlemap上顯示它。 NSLog(@「Google Data:%@」,places); 給我輸出...
免責聲明:書面內聯。沒有錯誤檢查! –
哪裏這部分是goint被宣佈? –
第一某處替換您的NSLog –