Google Places API リクエストを行う次のコードがあります。パラメータは現時点では静的に設定されています。代わりに、これらのパラメーター (タイプと緯度/経度、および .h ファイルで定数として定義した Google キー) オブジェクトを作成するにはどうすればよいですか?
フォーマット指定子を追加できないため、NSURL で問題が発生します。
助けてくれてありがとう。
-(void)ParseXML_of_Google_PlacesAPI
{
NSURL *googlePlacesURL = [NSURL URLWithString:@"https://maps.googleapis.com/maps/api/place/search/xml?location=34.0522222,-118.2427778&radius=500&types=bar&sensor=false&key=MyGoogleAPIKey"];
NSData *xmlData = [NSData dataWithContentsOfURL:googlePlacesURL];
xmlDocument = [[GDataXMLDocument alloc]initWithData:xmlData options:0 error:nil];
NSArray *arr = [xmlDocument.rootElement elementsForName:@"result"];
for(GDataXMLElement *e in arr )
{
[placesOutputArray addObject:e];
}