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