When the original Xcode 5.1.1 program was compiled with Xcode 6, it was found that the original written Cllocationmanager code and Mkmapview showuserlocation failed. Checked, XCode 6 uses the iOS 8 SDK to compile the app, you need to call Cllocationmanage's Requestalwaysauthorization method.
The procedure is as follows:
1. In the Didfinishlaunchingwithoptions: Method of Appdelegate [Self.window makekeyandvisible]; Then add the following code
Cllocationmanager *locationmanager = [[Cllocationmanager alloc] init]; Determine if IOS 8 if ([Locationmanager respondstoselector: @selector (requestalwaysauthorization)]) { [ Locationmanager Requestalwaysauthorization]; Perpetual authorization [Locationmanager requestwheninuseauthorization];//Authorization in Use } [Locationmanager Startupdatinglocation];
2. Add in Info.plist:
Nslocationwheninusedescription, allowing GPS descriptions to be obtained at the front desk
Nslocationalwaysusagedescription, allows the description of GPs to be acquired in the background
Complete.
Reference:
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
Workarounds for Cllocationmanager and Mkmapview showuserlocation failures in IOS 8