On-demand resources suddenly stopped working?

So yesterday I noticed that some of images in my app stopped appearing. All of them were placed in the on-demand resources, that is I've assigned tags to them. Up until yesterday they were working correctly but since then whenever I try to load the assets I get the error message saying:

Error Domain=NSCocoaErrorDomain Code=4099 "Connection invalidated to streaming unzip service."

My code for loading the asset is pretty straightforward and it was working perfectly fine before:

let resourceRequest = NSBundleResourceRequest(tags: ["vinyl"])
defer {
    resourceRequest.endAccessingResources()
}
do {
    if await !resourceRequest.conditionallyBeginAccessingResources() {
        try await resourceRequest.beginAccessingResources()
    }
} catch {
    assertionFailure("Vinyl image was not available, error: \(error)")
}

I'm obviously using it in asynchronous context, but the old method which used completion handler gives me the same error. Has anyone encountered this issue as well? I just updated my devices to iOS 15.5, maybe that update broke on-demand resources?

Tested on Xcode 13.4, iOS 15.5

Post not yet marked as solved Up vote post of wiencheck Down vote post of wiencheck
2.3k views

Replies

Hi! Did you manage to solve this issue? For me it was working fine last Friday but today that I ran my app my ODR suddenly stopped working and got that message.

I have exactly the same issue. When calling beginAccessingResources I get an error:

Error: Error Domain=NSCocoaErrorDomain Code=4099 "Connection invalidated to streaming unzip service."

I have checked if this is a issue with the PNG image (colour profile, compression etc.) but no mater what I did I still get the same error.

Environment

Xcode: 13.4.1, Device: iPhone 11 Max Pro, iOS: 15.6.1

I am also experiencing the same issue. Had a feeling that it was related to XCode 13.4.1, but after testing with previous versions the issue still persists. It does, however, not seem to happen for archived builds, but only when running directly from Xcode.

I had the same issue with ODR after updating a build to TestFlight. After deleting the app from the device and cleaning the derived data from Xcode ~/Library/Developer/Xcode/DerivedData I was able to fetch the ODR resources running from Xcode again.

XCode: 14.2, Device: iPhone 13 Pro Max, iOS: 16.2

Same here, deleting everything under the DerivedData for the app finally worked, just cleaning the build folder wasn't enough. Very odd bug..