Localizing the user on iOS 8

2019-06-18 01:28发布

Hullo, I am starting to port my apps to iOS 8 and I soon bounced into a problem with CLLocationManager. Basically the app no longer centers the map on the user's location and instead proposed error:

Trying to start MapKit location updates without prompting for location authorization. Must call -[CLLocationManager requestWhenInUseAuthorization] or -[CLLocationManager requestAlwaysAuthorization] first.

Executing

 [CLLocationManager requestAlwaysAuthorization]

does nothing and even inserting the NSLocationAlwaysUsageDescription key in the app’s Info.plist changes nearly nothing. In fact the only apparent effect of the operation is the location setting in the preferences that, upon running the app, has its value reset from the value I had entered.

3条回答
姐就是有狂的资本
2楼-- · 2019-06-18 01:32

I was having the same problem. I had edited the XXXTest-Info.plist file instead of XXXInfo.plist file. Now I got it working, with little less hair on my head.

查看更多
等我变得足够好
3楼-- · 2019-06-18 01:36

I added the two lines to my plist (see below), and furthermore i call [locationManager requestWhenInUseAuthorization]; first line in my viewDidLoad:..

Do you have any suggestions? =)

enter image description here

查看更多
仙女界的扛把子
4楼-- · 2019-06-18 01:38

in the string the keys write YES it will look like Application requires iPhone enviroment YES

查看更多
登录 后发表回答