Invalid parameter not satisfying: !stayUp || CLClientIsBackgroundable(internal->fClient)解决方法
2017-08-11 14:21
495 查看
报错的原因是没有开启定位的后台访问权限
解决方法:
1. 前台访问:
1. 后台访问:
一种方法是处在拥有
设置CLLocationManager的
然后打开Xcode -> Targets -> Capabilities 中的Background Modes并勾选其中的
以上步骤也可以通过以下配置.plist文件的方式实现 :
当然这种获取后台位置访问权限的方式有一个”弊端”, 那就是会有一个导航条大小的蓝色提示窗口出现在手机屏幕顶端, 这个提示会挤占手机屏幕空间, 很神奇~
我猜你一定喜欢另一种进行后台位置访问的方法, 那就是直接请求后台定位权限:
先看下官方文档怎么说:
The radius of uncertainty for the location, measured in meters. (read-only)
The location’s latitude and longitude identify the center of the circle, and this value indicates the radius of that circle. A negative value indicates that the location’s latitude and longitude are invalid.
In iOS, this property is declared as nonatomic. In OS X, it is declared as atomic.
我的理解是, 从地理空间的角度看, Apple称通过经纬度确定的位置为水平位置, 而通过海拔确定的位置是垂直位置, horizontalAccuracy则是通过该位置的经度和纬度确定的圆的半径. 该值越大表示精度越低, 也就是位置越不准确, 而负值则表示该位置是无效的, verticalAccuracy和海拔的关系也是如此, 官方文档说的应该很清楚了
在实际开发过程常常会对horizontalAccuracy的值进行判断以确定当前位置是否有效
解决方法:
1. 前台访问:
为.plist配置NSLocationWhenInUseUsageDescription
1. 后台访问:
一种方法是处在拥有
前台定位权限的情况下:
设置CLLocationManager的
allowsBackgroundLocationUpdates为
YES
然后打开Xcode -> Targets -> Capabilities 中的Background Modes并勾选其中的
Location updates选项
以上步骤也可以通过以下配置.plist文件的方式实现 :
<!--开启Background Modes中的Location updates--> <key>UIBackgroundModes</key> <array> <string>location</string> </array>
切记如果不开启Background Modes的Location updates选项将会导致以下错误的出现:
Assertion failure in -[CLLocationManager setAllowsBackgroundLocationUpdates:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/CoreLocationFramework_Sim/CoreLocation-1861.0.9/Framework/CoreLocation/CLLocationManager.m:604 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: !stayUp || CLClientIsBackgroundable(internal->fClient)'
当然这种获取后台位置访问权限的方式有一个”弊端”, 那就是会有一个导航条大小的蓝色提示窗口出现在手机屏幕顶端, 这个提示会挤占手机屏幕空间, 很神奇~
我猜你一定喜欢另一种进行后台位置访问的方法, 那就是直接请求后台定位权限:
- (void)requestAlwaysAuthorization // 并为.plist配置NSLocationAlwaysUsageDescription
CLLocation
关于这个类想说的东西只有一个, 那就是它的horizontalAccuracy和
verticalAccuracy属性, 从字面上看好像是水平精度和垂直精度的意思
先看下官方文档怎么说:
The radius of uncertainty for the location, measured in meters. (read-only)
The location’s latitude and longitude identify the center of the circle, and this value indicates the radius of that circle. A negative value indicates that the location’s latitude and longitude are invalid.
In iOS, this property is declared as nonatomic. In OS X, it is declared as atomic.
我的理解是, 从地理空间的角度看, Apple称通过经纬度确定的位置为水平位置, 而通过海拔确定的位置是垂直位置, horizontalAccuracy则是通过该位置的经度和纬度确定的圆的半径. 该值越大表示精度越低, 也就是位置越不准确, 而负值则表示该位置是无效的, verticalAccuracy和海拔的关系也是如此, 官方文档说的应该很清楚了
在实际开发过程常常会对horizontalAccuracy的值进行判断以确定当前位置是否有效
相关文章推荐
- IOS-Swift 百度地图 Invalid parameter not satisfying: !stayUp || CLClientIsBackgroundable
- 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: !stayUp || CLClientIs
- 'Invalid parameter not satisfying: URLString'网络请求的时候get使用特殊字符和汉字崩溃的恶心bug解决方法
- 'Invalid parameter not satisfying: URLString'网络请求的时候get使用特殊字符和汉字崩溃的恶心bug解决方法
- SSH框架 Bean property * is not writable or has an invalid setter method错误分析与解决方法
- Mabatis报错 java.sql.SQLException: Parameter number 3 is not an OUT parameter 解决方法
- parameter "bandwidth_type" is not a formal parameter of instantiated module的解决方法
- 新建数据库时出现collation '<服务器默认值>'is not valid.(Microsoft.SqlServer,Express.smo)的解决方法
- dubbo-admin-2.5.3 运行报错: Bean property 'URIType' is not writable or has an invalid 解决方法
- 异常:System.InvalidOperationException: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms 这个实现是不是Windows平台FIPS验证的加密算法。解决方法
- SSH框架 Bean property * is not writable or has an invalid setter method错误分析与解决方法
- SQL server 2005 创建数据库失败提示“Collation <服务器默认值> is not valid”解决方法
- 关于Files' name is invalid or does not exist的解决方法
- PCL 中 pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr 出现incomplete type is not allowed 的解决方法
- dubbo-admin-2.4.9 运行报错: Bean property 'URIType' is not writable or has an invalid 解决方法
- jspsmartupload Files' name is invalid or does not exist的解决方法
- SQL server 2005 创建数据库失败提示“Collation <服务器默认值> is not valid”解决方法
- 关于错误perhaps the designated entry point is not set的解决方法
- 普通用户开通sudo权限:xxx is not in the sudoers file.This incident will be reported.的解决方法
- this class is not key value coding-compliant for the key Button 错误解决方法