Ashok
Ashok

Reputation: 5655

Retrieving HealthKit data on main thread is causing the app crash for random users - iOS - Swift

I'm using HealthKit on my app to read user's health data and show them the data in the appropriate place on my app. For some production users(Major impact is on an iPhone X user), It's getting crashed while retrieving the health data using HealthKit(on Main Thread). But I'm not able to reproduce it.

Here is my code where I start taking the user permissions and read the health data.

Here is the crash information from fabric.

As per the crash info, it crashed while reading the DOB from HealthKit and I believe that there is no issue in getting DOB and I think the crash is happening because I'm reading health data on Main Thread and it might encounter with some multithreading issues. Tried with multiple devices, and I'm not able to reproduce the issue.

1) Any points on why reading the data from HealthKit on Main Thread is causing the crash?

2) Is the completion block I'm running on Main Thread expired/deallocated and might cause the crash?

Thanks.

Upvotes: 1

Views: 476

Answers (0)

Related Questions