[App仅在后台模式下在iOS 13上崩溃

问题描述 投票:0回答:1

[该应用仅在iOS 13上崩溃,当我看到详细报告时,有报告称该应用在崩溃时处于后台。没有参考崩溃日志中提到的代码行,在该行中我可以找到导致崩溃的行。请建议是否还有其他人也遇到过此类问题。

崩溃: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



这是我在beginBackgroundTask(expirationHandler :)中所做的事情。请更正我在这里做的错。


- (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];
}

ios objective-c crashlytics uibackgroundtask backgroundtaskidentifier
1个回答
2
投票

关键行是workspaceNoteAssertionExpirationImminent。您正在请求后台任务(可能是beginBackgroundTask(expirationHandler:)),并且该任务到期时,您将无法进行正确的清除。因此,您的应用会因被杀死而受到惩罚。

© www.soinside.com 2019 - 2024. All rights reserved.