5

iOS 6 で MapKit を使用して、特定の座標を持たずに近くの場所を取得するにはどうすればよいですか? また、Google Maps API を使用してこの目標を達成することがまだ可能かどうかもわかりません...エラー...許可されています。

すべてがまだベータ版であることは知っていますが、このトピックに関する情報は、フォーラム、Apple の新しい MapKit ドキュメント、どこにも見つかりませんでした。私がやりたいことは、ユーザーの場所から 'x' マイル以内の場所 (公園など) を検索することだけです。

どうやら Apple は独自のマップ アプリケーションを開発したため、MapKit または Core Location を使用してこれを実現する方法が必要なようです...そうですか?

4

1 に答える 1

2

このコードで試してください。これはあなたに役立つかもしれません。

URLManager *urlmanager = [[URLManager alloc] init];
        urlmanager.delegate = self;
        urlmanager.responseType = JSON_TYPE;
        urlmanager.commandName = @"Search";

NSString *locationString = [NSString stringWithFormat:@"%f,%f",latitude,longitude];
//Location where you want to search

NSString *key = @"AIzaSyCNRpero6aM451X0IfgFHAd-Y3eJUssqoa8`enter code here`0E";
//This is the secret key which you will get from the Google API Console when you register your app.

NSString *radiuos = @"15000";
//This is the area within which you want to search
NSString *keyword = @"Hotel";//Search keyword you want to search

NSMutableDictionary *arguments = [[NSMutableDictionary alloc] init]; // zero argument

[arguments setValue:key forKey:@"key"];

[arguments setValue:locationString forKey:@"location"];

[arguments setValue:radiuos forKey:@"radius"];

[arguments setValue:@"true" forKey:@"sensor"];

[arguments setValue:keyword forKey:@"keyword"];

NSLog(@"Arguments are %@",arguments);

[urlmanager urlCallGetMethod:[NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/search/json"] withParameters:arguments];
于 2013-02-12T04:17:36.143 に答える