Background Assets have a crash: EXC_BREAKPOINT

I am starting the app and fetching the current downloading tasks through BADownloadManager.sharedManager.fetchCurrentDownloadsWithCompletionHandler. Then, I am reinitiating the tasks through startForegroundDownload. However, occasionally there is a crash with EXC_BREAKPOINT

[BADownloadManager.sharedManager fetchCurrentDownloadsWithCompletionHandler:^(NSArray<BADownload *> * _Nonnull downloads, NSError * _Nullable error) {        
        if (error){            
            return;
        }
        for (BADownload *download in downloads) {
            if ([urlList containsObject:download.identifier]){
                if (download.state == BADownloadStateFailed) {                    
                    return;
                }
                NSError *downloadError;
                BOOL succes = [BADownloadManager.sharedManager startForegroundDownload:download error:&downloadError];
                if (downloadError) {
                    LogError(BADownloadLog,@"startForegroundDownload url:%@ error:%@",download.identifier,downloadError);
                }else if(succes){
                    LogInfo(BADownloadLog,@"startForegroundDownload:%@",download.identifier);
                    [self addDowdloadingUrl:download.identifier];
                }
            }
        }
    }];

Crash stack:

Crash reason:  EXC_BREAKPOINT / EXC_ARM_BREAKPOINT
Crash address: 0x21be8f638
Process uptime: 2 seconds

Thread 3 (crashed)
 0  BackgroundAssets!-[BADownloadManager startForegroundDownload:error:] + 0x100
    Found by: given as instruction pointer in context
 1  BackgroundAssets!-[BADownloadManager startForegroundDownload:error:] + 0xe0
    Found by: previous frame's frame pointer
 2  YYMobile!__46-[YYBADownloadManager executeDownload:finish:]_block_invoke [YYBADownloadManager.m : 180 + 0xc]
    Found by: previous frame's frame pointer
 3  libdispatch.dylib!_dispatch_call_block_and_release + 0x1c
    Found by: previous frame's frame pointer
 4  libdispatch.dylib!_dispatch_client_callout + 0x10
    Found by: previous frame's frame pointer
 5  libdispatch.dylib!_dispatch_lane_serial_drain + 0x298
    Found by: previous frame's frame pointer
 6  libdispatch.dylib!_dispatch_lane_invoke + 0x17c
    Found by: previous frame's frame pointer
 7  libdispatch.dylib!_dispatch_workloop_worker_thread + 0x284
    Found by: previous frame's frame pointer
 8  libsystem_pthread.dylib!_pthread_wqthread + 0x11c
    Found by: previous frame's frame pointer

The crash occurred at BOOL succes = [BADownloadManager.sharedManager startForegroundDownload:download error:&downloadError];

Replies

Crash stack:

That doesn’t look like an Apple crash report. Please remove your third-party crash reporter, reproduce the problem, and then post the Apple crash report per the advice in Posting a Crash Report.

For context, I believe you’re hitting an assert within -[BADownloadManager startForegroundDownload:error:]. However, it’s hard to say exactly which one because of the incomplete crash report.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"