0

I have a published app that has a need to keep the display on for an extended period of time. I use UIApplication.isIdleTimerDisabled to control it, setting it true when I need to keep the display on, and setting it false when it's no longer needed.

Since the app is distributed through the Apple App Store, I get reports when crashes occur. I sometimes get a report that points to a crash at a line where I call UIApplication.shared.isIdleTimerDisabled = false, i.e., where I'm restoring the normal state of affairs after the screen has been on for a while. Below is a screen shot of the stack trace.

enter image description here

I'm unable to reproduce the problem on my own. There are thousands of users who have downloaded and tried the program, and I only get one or two crash reports a week, so the problem must arise from some infrequently-occuring set of conditions. The crash reports come from a variety of iPhones and iPads running iOS 13 and 14.

Any ideas?

Jerry Agin
  • 629
  • 1
  • 5
  • 15
  • Is there a reason message that comes with the crash? My suspicion is that you need to dispatch to the main thread because controlling the display is UI-related. But since it's not easily reproduced, I'm not *sure* of that answer. – Phillip Mills Nov 28 '20 at 19:32
  • You may be right. I'm going to out the call in the main thread and see if it goes away. – Jerry Agin Nov 28 '20 at 21:03
  • That NSException is probably spitting some helpful message in the app's console log. Do you get those with crash reports? – mr. fixit Nov 29 '20 at 03:34

0 Answers0