简体   繁体   English

应用程序在后台模式下仅在 iOS 13 上崩溃

[英]App is crashing on only iOS 13 in the background mode

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.该应用程序仅在 iOS 13 上崩溃,当我看到详细报告时,报告提到该应用程序在崩溃时处于后台。 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崩溃:com.apple.main-thread

EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000f5e5f9c3c 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:).这就是我在 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];
}

The key line is workspaceNoteAssertionExpirationImminent .关键是workspaceNoteAssertionExpirationImminent You are asking for a background task (probably with beginBackgroundTask(expirationHandler:) ), and when it expires you are failing to do the correct cleanup.您正在请求后台任务(可能使用beginBackgroundTask(expirationHandler:) ),并且当它到期时,您无法进行正确的清理。 Therefore your app is punished by being killed dead.因此,您的应用程序会因被杀死而受到惩罚。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM