The app is crashing only on iOS 13 and when I saw the detailed report, Reports are mentioning the app was in the background when it was crashed. No reference of the line of code mentioned in the crash logs where I can find the line which is causing the crash. Please suggest if anyone else also face such type of problem ever.
Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000f5e5f9c3c
Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x1aed79d10 objc_opt_respondsToSelector + 20
1 Foundation 0x1af423588 _NSDescriptionWithStringProxyFunc + 56
2 CoreFoundation 0x1aefdc534 __CFStringAppendFormatCore + 7960
3 CoreFoundation 0x1aefddb10 _CFStringCreateWithFormatAndArgumentsAux2 + 152
4 Foundation 0x1af2f63c4 +[NSString stringWithFormat:] + 72
5 UIKitCore 0x1b30d95d8 -[_UIBackgroundTaskInfo description] + 144
6 UIKitCore 0x1b30e302c _fireBackgroundExpirationHandlers + 1068
7 UIKitCore 0x1b30e2b2c -[UIApplication workspaceNoteAssertionExpirationImminent:] + 136
8 FrontBoardServices 0x1b41adc50 __45-[FBSUIApplicationWorkspaceShim setDelegate:]_block_invoke_3 + 48
9 libdispatch.dylib 0x1aed01524 _dispatch_client_callout + 16
10 libdispatch.dylib 0x1aecaa434 _dispatch_block_invoke_direct$VARIANT$mp + 224
11 FrontBoardServices 0x1b41fe440 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 40
12 FrontBoardServices 0x1b41fe10c -[FBSSerialQueue _queue_performNextIfPossible] + 404
13 FrontBoardServices 0x1b41fe634 -[FBSSerialQueue _performNextFromRunLoopSource] + 28
14 CoreFoundation 0x1aefb9b64 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
15 CoreFoundation 0x1aefb9abc __CFRunLoopDoSource0 + 80
16 CoreFoundation 0x1aefb9244 __CFRunLoopDoSources0 + 184
17 CoreFoundation 0x1aefb4274 __CFRunLoopRun + 788
18 CoreFoundation 0x1aefb3c34 CFRunLoopRunSpecific + 424
19 GraphicsServices 0x1b90fd38c GSEventRunModal + 160
20 UIKitCore 0x1b30e622c UIApplicationMain + 1932
21 MagicBox Learning 0x104644058 main + 14 (main.m:14)
22 libdyld.dylib 0x1aee3b800 start + 4
This is what I am doing in beginBackgroundTask(expirationHandler:). Please correct what wrong I am doing here.
- (void)applicationDidEnterBackground:(UIApplication *)application {
self.isAppLaunched = NO;
_bgTask = [application beginBackgroundTaskWithExpirationHandler:^{
// Clean up any unfinished task business by marking where you
// stopped or ending the task outright.
[self cancelAllProductDownloadsInProgress];
dispatch_async(_MAGICBOX.databaseQueue, ^{
[application endBackgroundTask:self.bgTask];
self.bgTask = UIBackgroundTaskInvalid;
});
}];
//Dismiss keyboard
[self.window endEditing:YES];
}
stringWithFormat
anywhere in the code that might be related. – Preussen