美文网首页
The string "..." is an invalid v

The string "..." is an invalid v

作者: Peanut_S1 | 来源:发表于2019-08-12 14:55 被阅读0次

因为我们的app中用到了HealthKit,
最近Bugly频繁捕捉到iOS13系统一个必现的crash,描述为
the string "健康2" is an invalid value for NSHealthUpdateUsageDescription
经过定位,崩溃的地方为请求HealthKit授权,

  • (void)requestAuthorizationToShareTypes:(nullable NSSet<HKSampleType *> *)typesToShare
    readTypes:(nullable NSSet<HKObjectType *> *)typesToRead
    completion:(void (^)(BOOL success, NSError * _Nullable error))completion;这是HealthKit的API,
    因为是SDK的API方法,所以没法去改代码。经过百度和揣摩,也许NSHealthUpdateUsageDescription对应的value值描述的过于粗糙。
    因为我们一开始仅仅设定为“ 健康2”,后来改成了“爱家康需要您的同意,才能访问健康更新,给您带来更好的服务”
    然后在iOS13上run,竟然不crash了。
    搞到最后,竟是因为描述太粗糙,真是服了大苹果。描述太粗糙,竟然让app crash,给个警告也好呀。。。

相关文章

网友评论

      本文标题:The string "..." is an invalid v

      本文链接:https://www.haomeiwen.com/subject/splujctx.html