Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMPedometer SIGABRT crash iOS 10?

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?

like image 950
SimplyKiwi Avatar asked Jul 26 '16 21:07

SimplyKiwi


3 Answers

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>
like image 112
Kevin ABRIOUX Avatar answered Oct 22 '22 04:10

Kevin ABRIOUX


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.

like image 32
SimplyKiwi Avatar answered Oct 22 '22 05:10

SimplyKiwi


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.

like image 2
diogocarmo Avatar answered Oct 22 '22 03:10

diogocarmo