In my app I use Apple On Demand Resources.
I load the content with the following code:
currentRequest?.beginAccessingResources { (error: Error?) in
if let error = error {
onFailure(error as NSError)
return
}
onSuccess()
}
This works well with iOS 12 and Xcode 10, however with the latest iOS 13 and Xcode 11, I get the following error:
Begin: Request 0x0x283c498c0 response: Error: Error Domain=SZExtractorErrorDomain Code=4 "Hash mismatch for chunk containing offset 0: expected edf8721781dca63db1671ee3f0c7f199, got 621dea3aab25ce02a382f155971034c3" UserInfo={NSLocalizedDescription=Hash mismatch for chunk containing offset 0: expected edf8721781dca63db1671ee3f0c7f199, got 621dea3aab25ce02a382f155971034c3, SZExtractorActualHashValueErrorKey=621dea3aab25ce02a382f155971034c3, SZExtractorFileOffsetErrorKey=0, SZExtractorSourceFileLineErrorKey=470, SZExtractorFunctionNameErrorKey=-[StreamingUnzipState _checkHashForOffset:], SZExtractorHashChunkIndexErrorKey=0}`
I removed the assets, re-added them, tagged them, but the problem persists. What does this error mean?
I have encountered this error as well while developing an application on an iPhone 6s with iOS 13.1.2 using Xcode 11.0. On Demand Resources were working fine, but after changing non-related code, the completion handler of beginAccessingResourcesWithCompletionHandler:
of NSBundleResourceRequest
errored out with a hash mismatch error. I presume that the error means to tell that the request was not able to fetch the resources that were expected, at least according to the resource hash, which leads to the conclusion that the problem does not stem from the resources, but the expected hashes.
To clear the expected hashes, I have deleted my App from the development device and after rebuilding and deploying, on demand resources load again without error.
From our experience, the AppStore Review Team also encounters this error on their end from time to time. If you get a Rejection where the condition is caused by this error, tell them to remove the app from their device(s) before launching their tests again.
It might take a few attempts, but you'll eventually get a Reviewer that listens.
On-Demand Resource Management on iOS 13 appears to be wildly unreliable and prone to this hashing issue. The underlying issue is that the device is attempting to continue the download of a pending older version of the Asset Package and when attempting to merge the packets, it's encountering a hash that it is not expecting and breaking the file structure within the package.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With