iOS 6中的MapKit - 如何查找附近的地点...?

5
在iOS 6中使用MapKit,如果没有特定坐标,如何获取附近的位置?我也不确定是否仍然可以使用Google Maps API来实现此目标,因为这是我能想到的唯一方法。

我知道一切仍处于Beta阶段,但我仍然在任何地方找不到关于这个主题的信息,在论坛上,在苹果的新MapKit文档中,或者其他地方。我想做的就是搜索位置(比方说,公园),离用户位置“x”英里以内。

看起来由于苹果已经开发了自己的Maps应用程序,他们应该有一种使用MapKit或Core Location来完成这个任务的方式......对吧?


4
抱歉,这个话题不能在SO上讨论。这是NDA涉及到的内容。您可以尝试在苹果开发者论坛上讨论。那里有时会有苹果工程师出没。 - Warren Burton
看看WWDC 2012的视频 - 那里可能会有一些东西。他们确实演示了类似的东西,但我记不清细节了。抱歉。 - Robotic Cat
不再是保密协议,6.1版本包含了实际的代码,但几乎没有文档。我不知道苹果公司怎么了,他们曾经在文档编写方面是最好的,现在也变成了另一个“讲解很麻烦”的公司了... - Rob
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];

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接