Invalid parameter not satisfying: !stayUp || CLClientIsBackgroundable(internal->fClient)解决方法
来源:互联网 发布:信捷xc软件 编辑:程序博客网 时间:2024/06/06 01:50
报错的原因是没有开启定位的后台访问权限
解决方法:
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的值进行判断以确定当前位置是否有效
- Invalid parameter not satisfying: !stayUp || CLClientIsBackgroundable(internal->fClient)解决方法
- IOS-Swift 百度地图 Invalid parameter not satisfying: !stayUp || CLClientIsBackgroundable
- 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: !stayUp || CLClientIs
- 'Invalid parameter not satisfying: date
- 'Invalid parameter not satisfying: URLString'
- NSInternalInconsistencyException Invalid parameter not satisfying: URLString
- AFNetworking提示Invalid parameter not satisfying: URLString
- [AFHTTPRequestSerializer requestWithMethod:URLString; 'Invalid parameter not satisfying: URLString'
- [AFHTTPRequestSerializer requestWithMethod:URLString; 'Invalid parameter not satisfying: URLString'
- ios reason: 'Invalid parameter not satisfying: url'((无效的URL))
- AFN 报错 Invalid parameter not satisfying: URLString
- Xcode7.1(无效的URL)Invalid parameter not satisfying: URLString -- @ShinePug
- 使用AFNetworking上传图片操作的时候出现reason: 'Invalid parameter not satisfying: name’?
- could not locate named parameter 的解决方法
- unity3d "vert": output parameter ' ' not completely intialized的解决方法
- Mabatis报错 java.sql.SQLException: Parameter number 3 is not an OUT parameter 解决方法
- Latex error "Not enough room in an internal buffer" 解决方法
- Invalid parameter number: number of bound variables does not match number of tokens
- Intellij Idea git切换远程分支
- LeetCode 9 Palindrome Number
- controller方法返回值(10)
- 中国制造2025,SRM——供应商管理系统的价值
- 大数据时代必修技能 阿里HBase又放出了哪些大招?
- Invalid parameter not satisfying: !stayUp || CLClientIsBackgroundable(internal->fClient)解决方法
- Bootstrap(1)__Bootstrap基础<页面排版,图片,按钮,表格,表单>
- fastjson案例[L]
- 关于QuickRopes参数设置不当导致的拖动时抖动厉害的参数设置
- MySQL:数据结构及算法原理
- 使用SLXT传输翻译文本
- 第001篇
- matlab画多线条图
- 桌面的小功放声音放大,去除噪声。