CMPedometer SIGABRT崩溃iOS 10?

时间:2016-07-26 21:38:20

标签: ios sigabrt ios10 pedometer

我目前正在iOS 10 Beta 3上测试一个应用程序,由于某些奇怪的原因,每当我执行这一个方法时,它似乎都会在下面的startPedometerUpdatesFromDate行崩溃:

if (!_pedometer) {
    _pedometer = [[CMPedometer alloc] init];
}
[_pedometer startPedometerUpdatesFromDate:[NSDate date] withHandler:^(CMPedometerData * _Nullable pedometerData, NSError * _Nullable error) {

我已确认_pedometer不是nil,因为它在升级之前在iOS 9中有效,所以更奇怪。

控制台中没有任何内容表明代码有任何问题,当它崩溃时只会导致这种情况(即使有异常断点):

libsystem_kernel.dylib`__abort_with_payload:
    0x183a58d94 <+0>:  movz   x16, #0x209
    0x183a58d98 <+4>:  svc    #0x80
->  0x183a58d9c <+8>:  b.lo   0x183a58db4               ; <+32>
    0x183a58da0 <+12>: stp    x29, x30, [sp, #-16]!
    0x183a58da4 <+16>: mov    x29, sp
    0x183a58da8 <+20>: bl     0x183a3d7dc               ; cerror_nocancel
    0x183a58dac <+24>: mov    sp, x29
    0x183a58db0 <+28>: ldp    x29, x30, [sp], #16
    0x183a58db4 <+32>: ret  

我还确保在我的 Info.plist 中包含隐私 - 健康更新使用说明和隐私 - 健康共享使用说明。它也在iPhone 6 Plus上进行测试,所以我不太确定问题是什么。有什么我想念的吗?

3 个答案:

答案 0 :(得分:14)

iOS 10已更新隐私政策并实施了新的隐私规则。您必须通过授权询问,使用以下字段更新您的Info.plist应用。

将在提示授权时显示说明文字。

<!--  Photo Library -->
<key>NSPhotoLibraryUsageDescription</key>
<string><Your description goes here></string>

<!--  Camera -->
<key>NSCameraUsageDescription</key>
<string><Your description goes here></string>

<!--  Microphone -->
<key>NSMicrophoneUsageDescription</key>
<string><Your description goes here></string>

<!--  Location -->
<key>NSLocationUsageDescription</key>
<string><Your description goes here></string>

<!--  Location When In Use -->
<key>NSLocationWhenInUseUsageDescription</key>
<string><Your description goes here></string>

<!--  Location Always -->
<key>NSLocationAlwaysUsageDescription</key>
<string><Your description goes here></string>

<!--  Calendars -->
<key>NSCalendarsUsageDescription</key>
<string><Your description goes here></string>

<!-- ⏰ Reminders -->
<key>NSRemindersUsageDescription</key>
<string><Your description goes here></string>

<!--  Motion -->
<key>NSMotionUsageDescription</key>
<string><Your description goes here></string>

<!--  Health Update -->
<key>NSHealthUpdateUsageDescription</key>
<string><Your description goes here></string>

<!--  Health Share -->
<key>NSHealthShareUsageDescription</key>
<string><Your description goes here></string>

<!-- ᛒ Bluetooth Peripheral -->
<key>NSBluetoothPeripheralUsageDescription</key>
<string><Your description goes here></string>

<!--  Media Library -->
<key>NSAppleMusicUsageDescription</key>
<string><Your description goes here></string>

答案 1 :(得分:11)

Apple Engineering在提交错误报告后给了我以下反馈:

此应用已崩溃,因为它试图在没有使用说明的情况下访问隐私敏感数据。应用程序的Info.plist必须包含一个NSMotionUsageDescription键,其中包含一个字符串值,向用户解释应用程序如何使用此数据。

答案 2 :(得分:2)

来到这里说得到了同样的错误,但在我的案例中却遗漏了NSContactsUsageDescription。我希望他们有更好的错误信息。