最近使用ios定位功能,但是总是定位不成功,不能获取定位数据,找了好久原因,终于发现问题所在,原来是ios8之前的规则已经不适用了。
先从ios developer library 中找到相关的说明。
You must call this method(
- requestWhenInUseAuthorization) or the requestAlwaysAuthorization
method prior to using location services.
Knowing When to Start Location Services
Apps that use location services should not start those services until they’re needed. With a few exceptions, avoid starting location services immediately at launch time or before such services might reaso