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

问题描述:

在iOS 6中使用MapKit,我该如何在没有特定坐标的情况下获取附近位置?我也不确定它是否仍有可能......错误... 允许 ...使用Google Maps API来实现此目标,因为这是我能想到的唯一方法。

我知道一切仍处于测试阶段,但在任何地方,关于此主题,论坛,Apple的新MapKit文档中都找不到任何信息。我想要做的就是在用户所在位置的'x'英里范围内搜索位置(比如说,公园)。


看来,自从Apple开发了他们自己的Maps应用程序以来,他们应该有办法使用MapKit或Core Location来完成这个任务......对吧?

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

+4

对不起,但不能在SO上讨论。它的NDA。试试Apple开发者论坛。苹果工程师有时会在那里闲逛。 –

+0

查看WWDC 2012视频 - 这里可能有些东西。他们做了类似的演示,但我不记得细节。道歉。 –

+0

它不再是NDA,6.1包含了实际的代码,但仍然没有任何文档。我不知道苹果公司发生了什么事情,他们曾经是记录事物的最佳人选,现在他们正在成为另一种“解释也很麻烦”的人。 – Rob

试试用此代码。这可能对你有帮助。

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