tl;dr – UIApplication.shared.idleTimerDisabled now causes an undocumented crash if you compile with the iOS 13 SDK and use it from a background thread.
VLC Streamer is one of my oldest apps. It has been going strong since 2008!
It’s a pretty complex app with a bunch of different code paths and edge cases. It’s mostly written in Objective-C.
I uploaded a new build on Jun 15, 2019 to deal with some details around new device screens. No problems there.
I uploaded again on November 20th. There were two relevant changes.
- I updated the base SDK to 11.0 (from 9.0)
- I compiled with the latest XCode using the 13.0 SDK
I woke up on the 22nd to get loads of crash reports. One of my code paths calls this from a background thread:
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
This now causes a crash.
Three things of note here for me
- Nothing in the documentation says you can’t call idleTimerDisabled from a background thread.
- No code has changed. I just recompiled and resubmitted. The old build worked, the new build crashes.
- Why is this even an issue? If Apple really need this flag to be changed on the main thread – couldn’t they dispatch it to main in the implementation?
Of course – better testing would have caught this, but how many of us really have proper UI testing in all of our code paths…
Building a test app with iOS 9 as the target still gives the crash.
Presumably this means that the change has come from using XCode 11.2.1 and the iOS 13 SDK.