On-Demand Resources in iOS apps running on Apple silicon Macs

I'm trying to get my iOS app to work on Apple silicon Macs, but ODR (On-Demand Resources) don't seem to work. It seems like the Xcode doesn't even acknowledge existence of ODR in the project when run as an iOS app for Mac on my M1 MacBook Air.

I've created a very simple Xcode project to verify the issue, which only has a single image tagged as ODR. Checking the Disk tab in the Debug navigator, the ODR is shown correctly when running on a simulator:

...Yet when run as an iOS app for Mac it simply shows No Resources:

The beginAccessingResources(...) call predictably fails, too, with the following error:

Error: Error Domain=AssetErrorDomain Code=7 "Invalid status code `404`" UserInfo={NSDebugDescription=Invalid status code `404`, NSUnderlyingError=0x600003fd5fb0 {Error Domain=AssetErrorDomain Code=1404 "(null)"}}

There are other messages in the console that could be related to the issue. The first thing the app logs when run as an iOS app for Mac, is this message repeated several times:

2022-01-20 12:14:41.566305+0000 ODRTest[29926:333135] [default] could not create original path for node <FSNode 0x600003191ca0> { isDir = ?, path = '/private/var/folders/kw/g_lttmtn0yx747mvzjmbksbc0000gn/X/FE0DB2BA-8F2D-5783-9BE1-891F8E117EC9/d/Wrapper/ODRTest.app' }, proceeding: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"

ODRTest is the name of the Xcode project I use to reproduce the issue. Nothing else is logged apart from these repeated messages and the ODR request error.

The documentation here seems to explicitly suggest that ODR should work fine, so I'm guessing this is some odd configuration error on my machine — perhaps related to file system access? I've tried updating macOS and re-installing Xcode to latest from scratch to no avail.

Anything else I'm missing here?

I am having the same problem with 404 and 1404 error codes. Sorry that I am of no help. The API documentation of NSBundleResourceRequest says "This class ignores calls from Mac apps built with Mac Catalyst." and I am wondering if this is also true for M1 apps designed for iPad.

There two issues in play here:

  • On-demand resources for iOS Apps on Mac

  • On-demand resources for macOS apps

The first should work. This is clearly called out in Running your iOS apps in macOS.

The latter is not expected to work. ODR is not available on macOS, and Mac Catalyst apps are macOS apps.

Share and Enjoy

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

Is there a suggested alternative for on-demand resources in a Catalyst app? This is a really key feature that's missing. Our app size on iOS is quite reasonable but all the resources for the macOS Catalyst app make the download size too big (~2GB). Is there some way to use the Hosted Asset-Packs URL with iCloud? Our app currently does not have any need for our own web server and so we'd like to find an Apple-supported solution. Thanks!

Honestly, I think you’d be better off doing this with a third-party service. You wrote:

Our app currently does not have any need for our own web server

You don’t have to stand up your own server for this. There are plenty of third-party services that can vend large assets on your behalf (Amazon S3 being the 364 kg gorilla in this space).

On the Apple front, one possible workaround would be to attach your assets to the CloudKit public database. I’m not 100% sure that is practical, however. CloudKit isn’t really my area of expertise.

Share and Enjoy

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

On-Demand Resources in iOS apps running on Apple silicon Macs
 
 
Q