Solution for CLLocationManager and MKMapView showUserLocation failure in iOS 8, ioscllocation
When using XCode 6 compiled programs written in XCode 5.1.1, the Code originally written in CLLocationManager and the showUserLocation of MKmapView are invalid. Check that the requestAlwaysAuthorization method of CLLocationManage needs to be called to compile the app using iOS 8 SDK in XCode 6.
The procedure is as follows:
1. In the didfinishlaunchingwitexceptions of AppDelegate: [self. window makeKeyAndVisible] In the method, add the following code:
CLLocationManager * locationManager = [[CLLocationManager alloc] init]; // determines whether the listener is iOS 8 if ([locationManager respondsToSelector: @ selector (requestalwaythorsauization)]) {[locationManager requestalwaysauization]; // permanently authorize [locationManager requestWhenInUseAuthorization]; // In-use authorization} [locationManager startUpdatingLocation];
2. Add the following to info. plist:
NSLocationWhenInUseDescription, which allows you to obtain the GPS description on the foreground
NSLocationAlwaysUsageDescription, which allows you to obtain the GPS description in the background.
Complete.
Refer:
Http://www.cnblogs.com/tx8899/p/3989087.html
Http://blog.uniba.jp/post/91830563468/ios-8
Http://www.cocoachina.com/bbs/read.php? Tid-217107.html
Http://www.cocoachina.com/ask/questions/show/87714
Http://9to5mac.com/2014/06/04/apple-improves-location-services-in-ios-8-with-when-in-use-mode-visit-monitoring/
Http://derjohng.doitwell.tw/6197/%E9%9B%BB%E8%85%A6%E9%A1%9E%E5%88%A5/%E8%BB%9F%E9% AB %94%E7%AD%86%E8%A8%98/ios8-%E4%B8%8B%E5% AE %9A%E4%BD%8D-cllocationmanager-%E7%9A%84%E6%94%B9%E8% AE %8A/
Http://www.cocoachina.com/ask/questions/show/113705/CLLocationManager%E8%8E%B7%E5%8F%96%E5%9C%B0%E5%9D%80%E5%81%8F%E5%B7% AE
CLLocationManager for IOS
This has nothing to do with the code. It can be basically located on a real machine, and the location information cannot be obtained on the simulator.
For IOS CLLocationManager Problems
CLLocationManager acquires the location through the Protocol, that is, when the longitude and latitude are obtained, it is passed to the caller in the form of a message, which is an asynchronous execution method.
Your idea is synchronous. Unless you use blocking to encapsulate the asynchronous mechanism as synchronous, your wish will not be fulfilled.
Of course, if You encapsulate it as synchronization, the performance will be greatly affected, which is not officially recommended.