Hi Kevin
I appreciate the response, and thanks for the insight into pre-warming - I noticed there's been less noise about pre-warming since iOS 15 so that makes some sense given what you've mentioned. It's also pushed me to try and understand what exactly is the root cause of my issue, with the hope that it's not related to this feature!
What's the issue you're actually having?
I have a sample app (it's a little contrived so bear with me) which has been able to demonstrate the issue on an iOS 18 14 Pro physical device produced from the Xcode 16 Release build.
The app has no special UIBackgroundModes or Push notifications etc. All it does is write a string to the keychain on the first loop with kSecAttrAccessible: kSecAttrAccessibleWhenUnlockedThisDeviceOnly, and then every subsequent loop reads this data. This repeats infinitely every 0.5 seconds and is started just before returning true in didFinishLaunchingWithOptions. The status of the read query is then logged to a file with a timestamp and the UIApplicationState.
What I'm observing is that if I open the app, then lock my device, then sometimes after a period of being in the background it starts executing code again. In this case, it tries to run my looping code, which reads the keychain which then fails with errSecInteractionNotAllowed, probably because the keychain is locked as the app is in the background.
Does this sound like prewarming behaviour or is this likely something else?
Here's some logs that were produced from the sample app:
date, keychain query status (OSStatus), UIApplication.State
2024-09-20 14:57:27 +0000, 0, Active
2024-09-20 14:57:28 +0000, 0, Active
2024-09-20 14:57:28 +0000, 0, Active
2024-09-20 14:57:29 +0000, 0, Active
2024-09-20 14:57:29 +0000, 0, Inactive
2024-09-20 14:57:30 +0000, 0, Inactive
2024-09-20 14:57:30 +0000, 0, Background
2024-09-20 14:58:02 +0000, 💣 errSecInteractionNotAllowed, Background
2024-09-20 14:58:02 +0000, 💣 errSecInteractionNotAllowed, Background
2024-09-20 14:58:03 +0000, 0, Background
2024-09-20 14:58:04 +0000, 0, Inactive
2024-09-20 14:58:04 +0000, 0, Active
2024-09-20 14:58:05 +0000, 0, Inactive
2024-09-20 14:58:05 +0000, 0, Inactive
2024-09-20 14:58:06 +0000, 0, Inactive
2024-09-20 14:58:06 +0000, 0, Background