在iOS 6中使用MapKit,我应该如何在没有特定坐标的情况下到达附近的位置?我也不确定它是否还有可能......错误...... 允许 ...使用Google Maps API来实现这一目标,因为这是我能想到的唯一方法。
我知道一切都还处于测试阶段,但我仍然没有在任何地方找到关于这个主题的信息,在论坛上,在Apple的新MapKit文档中。我想要做的就是在用户位置的'x'英里内搜索位置(例如,公园)。
由于Apple开发了自己的地图应用程序,他们应该有办法使用MapKit或Core Location来实现这一点......对吗?
答案 0 :(得分: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];