Summary
I'm using Background Assets to download Apple-hosted Asset Packs(downloadPolicy = onDemand). The first
download cancellation succeeds, but on the second and subsequent downloads,
progress.cancel() fails to work and the download completes to the end.
Environment
iOS 26.0 – 26.3 RC (all produce the same result)
Xcode Version 26.2 (17C52)
Using Apple-hosted Asset Packs
Steps to Reproduce
Start downloading an Asset Pack
Call progress.cancel() during download → Succeeds
Start downloading the same Asset Pack again
Call progress.cancel() during download → Fails (download completes to the end)
Observed Error Logs
After 1st cancellation:
A download with the ID "X-XXXXXXXX-XXX" failed: Error Domain=NSURLErrorDomain
Code=-999 "cancelled"
↑ This is expected (cancellation succeeded)
The fact that version 0 of the asset pack with the ID "X-XXXXXX-XXX" finished being
downloaded couldn't be reported: Error Domain=NSCocoaErrorDomain Code=3851
"Property list invalid for format: 200 (property lists cannot contain objects of
type 'CFError')"
↑ Problem: Unable to serialize CFError to plist
2nd cancellation attempt:
The download with the ID "X-XXXXXX-XXX" couldn't be canceled: Error
Domain=BAErrorDomain Code=113 "The requested download operation failed because the
download object did not exist."
↑ The download object we're trying to cancel supposedly doesn't exist
Implementation Code
// Cancel implementation
func cancel(tag: String) async {
let statusUpdates = AssetPackManager.shared.statusUpdates(forAssetPackWithID:
tag)
for await statusUpdate in statusUpdates {
if case .downloading(_, let progress) = statusUpdate,
progress.isCancellable
{
progress.cancel()
}
}
}
Analysis
It appears that when the first cancellation occurs, the system internally tries to
save the cancellation state to a plist, but fails to serialize the CFError object.
This seems to cause an inconsistent internal state, preventing the system from
correctly recognizing the download object on subsequent downloads.
Questions
Is there a workaround?
Is there a planned fix for a future iOS version?
2
1
159