iOS 10 因苹果健康导致闪退

如果在app中调用了苹果健康,iOS10中会出现闪退。
报错为:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NSHealthUpdateUsageDescription must be set in the app's Info.plist in order to request write authorization.'

这是因为info.plist文件中声明苹果健康的使用权限,所以要在info.plist中添加以下key。

请求写入
<key>NSHealthUpdateUsageDescription</key><string>some string value stating the reason</string>

请求读取
<key>NSHealthShareUsageDescription</key> <string>some string value stating the reason</string>
530099-eeb093bef60afa52.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容