iOS 8 MKMapView User Location Request Failure

隐身守侯 提交于 2019-11-29 12:21:26
merlos

I had the same problem a few days ago. The solution was adding the string keys NSLocationAlwaysUsageDescription (for [CLLocationManager requestAlwaysAuthorization]) or NSLocationWhenInUseUsageDescription (for [CLLocationManager requestWhenInUseAuthorization]) to your Supporting Files/Info.plist

You can also edit the source code of the Info.Plist with Right click > open as > Source code and add these lines:

<!-- for requestAlwaysAuthorization -->
<key>NSLocationAlwaysUsageDescription</key>
<string>Explain for what are you using the user location</string>
<!-- for requestWhenInUseAuthorization -->
<key>NSLocationWhenInUseUsageDescription</key>
<string>Explain for what are you using the user location</string>

Hope this helps.

Finally I have succeeded to run my gpx file on the simulator. It seems that after installing Xcode 6 the first time, there might be a bug causing for gpx files to simulate. Here is how I overcame the problem:

  1. I have deleted my app from the simulator
  2. Under App->Capabilities enabled Background Modes->Location updates
  3. Run the app and let it install on simulator
  4. Allow access, and I was able to locate the user with GPX
  5. Afterwards I disabled Location Updates.

I don't know why, but this did the trick for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!