I have a specific crash for iOS14 only. My code has not changed for a long time and there were no issues on all previous versions of iOS, but according to Crashlytics I see this stacktrace:
Crashed: com.apple.main-thread
0 libdispatch.dylib 0x19125b7f4 <redacted> + 36
1 libdispatch.dylib 0x1912298c4 dispatch_group_leave + 126
2 MyApp 0x104e2c72c partial apply for closure #1 in AppDelegate.application(_:didReceiveRemoteNotification:fetchCompletionHandler:) + 4375054124 (<compiler-generated>:4375054124)
3 MyApp 0x104e2b488 closure #1 in closure #2 in AppDelegate.configureNotificationReceipt(userInfo:completionHandler:) + 194 (AppDelegate.swift:194)
4 MyApp 0x104e48d78 closure #1 in closure #1 in static AWSController.downloadFile(with:completion:) + 37 (AWSController.swift:37)
5 MyApp 0x104e5d794 thunk for @escaping @callee_guaranteed () -> () + 4375254932 (<compiler-generated>:4375254932)
6 libdispatch.dylib 0x191226fd0 <redacted> + 32
7 libdispatch.dylib 0x191228ac8 <redacted> + 20
8 libdispatch.dylib 0x19123604c _dispatch_main_queue_callback_4CF + 836
9 CoreFoundation 0x1915a71e4 <redacted> + 16
10 CoreFoundation 0x1915a13b4 <redacted> + 2508
11 CoreFoundation 0x1915a04bc CFRunLoopRunSpecific + 600
12 GraphicsServices 0x1a8025820 GSEventRunModal + 164
13 UIKitCore 0x193f44734 <redacted> + 1072
14 UIKitCore 0x193f49e10 UIApplicationMain + 168
15 MyApp 0x104e16e30 main + 17 (AppCoordinator.swift:17)
16 libdyld.dylib 0x191267e60 <redacted> + 4
Also there is info from Crashlytics:
BUG IN CLIENT OF LIBDISPATCH: Unbalanced call to dispatch_group_leave()
I use Firebase/Messaging for notifications. Also there is a code for handling of notification:
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any],
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
configureNotificationReceipt(userInfo: userInfo) { (result) in
completionHandler(result)
}
}
As I wrote this crash is only for iOS14 and it was not there before. If we're speaking about Unbalanced call to dispatch_group_leave() I would say that it's related to internal logic of iOS maybe, because I don't work with GCD explicitly anywhere.
Perhaps someone has already encountered the same behavior and can suggest any workaround?