CMPedometer SIGABRT crash iOS 10?
Asked Answered
B

3

5

I have an app I am testing on iOS 10 Beta 3 currently, and for some odd reason whenever I execute this one method, it seems to be crashing on the startPedometerUpdatesFromDate line below:

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

I have confirmed that _pedometer is not nil and it is even more odd as it worked in iOS 9 before I upgraded.

There is nothing in the console that suggests anything wrong with the code, and when it crashes it just leads to this (even with exception breakpoints):

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  

I also made sure to include Privacy - Health Update Usage Description and Privacy - Health Share Usage Description in my Info.plist. It is also being tested on an iPhone 6 Plus so I am not quite sure what the issue could be. Is there anything I am missing?

Bilection answered 26/7, 2016 at 21:38 Comment(2)
@matt adjusted it in my code. However to anyone out there experiencing the same, it must be an iOS 10 bug because MPMusicPlayerController seems to have the same issue when accessing the systemMusicPlayer. Also there has been an open radar for something similar here: openradar.appspot.com/26850414 – Bilection
I'm also getting with iOS10 and AVCaptureSession: triggered when I call - (void)addInput:(AVCaptureInput *)input; – Squarely
B
11

Apple Engineering has gave me the following feedback after filing a bug report:

This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSMotionUsageDescription key with a string value explaining to the user how the app uses this data.

Bilection answered 8/8, 2016 at 0:19 Comment(0)
B
14

iOS 10 has updated privacy policy and implemented new privacy rules. You have to update your Info.plist app with this following fields by authorisation asked.

Description text will be displayed when authorization will be prompted.

<!-- πŸ–Ό 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>
Belly answered 27/9, 2016 at 10:56 Comment(1)
Contacts <key>NSContactsUsageDescription</key> <string>description</string> – Senhauser
B
11

Apple Engineering has gave me the following feedback after filing a bug report:

This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSMotionUsageDescription key with a string value explaining to the user how the app uses this data.

Bilection answered 8/8, 2016 at 0:19 Comment(0)
G
2

Came here to say that got the same error, but it was missing NSContactsUsageDescription in my case. I wish they'd have a better error message.

Gangue answered 22/9, 2016 at 17:35 Comment(0)

© 2022 - 2024 β€” McMap. All rights reserved.