My app crashes/restarts (depending on the iOS version) when it spends prolonged time (>30seconds) in the background
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: SIGNAL 6 Abort trap: 6
Terminating Process: iosApp [10586]
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001d4ac92d4 __pthread_kill + 8 (:-1)
1 libsystem_pthread.dylib 0x000000020e0a459c pthread_kill + 268 (pthread.c:1721)
2 libsystem_c.dylib 0x000000018b2cdb9c __abort + 136 (abort.c:163)
3 libsystem_c.dylib 0x000000018b2cdb14 abort + 140 (abort.c:130)
4 libc++abi.dylib 0x000000020dfca5b8 abort_message + 132 (abort_message.cpp:78)
5 libc++abi.dylib 0x000000020dfc9888 std::__terminate(void (*)()) + 28 (cxa_handlers.cpp:61)
6 libc++abi.dylib 0x000000020dfcd0ac __cxa_rethrow + 204 (cxa_exception.cpp:648)
7 libobjc.A.dylib 0x00000001809e5730 objc_exception_rethrow + 44 (objc-exception.mm:399)
8 CoreFoundation 0x0000000183528378 CFRunLoopRunSpecific + 848 (CFRunLoop.c:3450)
9 GraphicsServices 0x00000001d06a14c0 GSEventRunModal + 164 (GSEvent.c:2196)
10 UIKitCore 0x000000018606e77c -[UIApplication _run] + 816 (UIApplication.m:3846)
11 UIKitCore 0x0000000185c94e64 UIApplicationMain + 340 (UIApplication.m:5503)
12 SwiftUI 0x0000000187e28660 closure #1 in KitRendererCommon(_:) + 168 (UIKitApp.swift:68)
13 SwiftUI 0x0000000187e28590 runApp<A>(_:) + 100 (UIKitApp.swift:16)
14 SwiftUI 0x0000000187e28474 static App.main() + 180 (App.swift:121)
15 iosApp 0x00000001047c375c static iOSApp.$main() + 52 (iOSApp.swift:0)
16 iosApp 0x00000001047c375c main + 64
17 dyld 0x00000001a96fcde8 start + 2724 (dyldMain.cpp:1338)
Above is the crashlog. My findings are that the iOS watchdog is shutting down the app because it is using some resources in the background which the access is restricted e.g network calls, location, etc, however I have granted requisite access in my info.plist and I still experience this issue.