Thanks for popping over to DevForums.
The code you posted looks like it’s trying to block inside
applicationDidEnterBackground(_:). That will end badly. That method is called on the main thread and is expected to return promptly, say, within a few tens of milliseconds. Keep in mind that, because it’s running on the main thread, it prevents the main thread from doing anything else, and if it does that for too long you’ll eventually get killed by the watchdog.
How you fix this depends on the bigger picture within your app. You wrote:
ps You can make your posts easier to read if you format code as code, using the
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"