簡體   English   中英

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

[英]MapKit in iOS 6 - How to Find Places Nearby…?

在iOS 6中使用MapKit,我應該如何在沒有特定坐標的情況下到達附近的位置? 我也不確定它是否仍有可能......錯誤...... 允許 ......使用Google Maps API來實現這一目標,因為這是我能想到的唯一方法。

我知道所有內容仍處於測試階段,但我仍然沒有在任何地方找到有關此主題的信息,無論是在論壇上,在Apple的新MapKit文檔中。 我想要做的就是在用戶位置的'x'英里內搜索位置(例如,公園)。

看來,既然Apple開發了自己的Maps應用程序,他們應該有辦法使用MapKit或Core Location來實現這一點......對嗎?

嘗試使用此代碼。 這可能對你有所幫助。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM