且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在IOS SDK 8.0中获取当前位置的经度和纬度

更新时间:2022-12-29 20:56:35

我在IOS 8.0中找出问题

I figure it out issue in IOS 8.0

NSLocationAlwaysUsageDescription 将此手动添加到应用程序plist文件中,将字符串值保留为空。
这将调用委托方法。永远不要忘记添加 NSLocationAlwaysUsageDescription ,除非您没有添加此委托方法将无法正常工作。剩下的代码是一样的。将委托方法添加到控制器类。

NSLocationAlwaysUsageDescription add this manually into application plist file, leave string value empty. This it will call the delegate methods. Never forgot about adding NSLocationAlwaysUsageDescription unless you not added this delegate method will not work. Remaining code is same. with adding delegate methods to controller class.

在locationManager声明代码中添加此行代码。对于IOS 8.0
[locationManager requestAlwaysAuthorization];

add this line of code in locationManager declaration code. for IOS 8.0 [locationManager requestAlwaysAuthorization];