I have implemented On Demand Resources (ODR) in my iOS app using Swift. The ODR feature works correctly when running the app directly from Xcode 15.3. However, when I archive the app and install the release build on a real device, the ODR feature fails to function as expected.
I followed up this doc. https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/On_Demand_Resources_Guide/index.html#//apple_ref/doc/uid/TP40015083-CH2-SW1
I have read that adding specific entitlements for ODR might be necessary, but I'm unsure how to properly configure this.
Depending on how you configured testing for a Release build, that might not be enough to actually test ODR resources as hosted resources coming from a server. For that, make sure you're exporting the app for testing, following our guidance in Testing a release build, and select either Development or Ad-Hoc to export a complete version of your app. As part of the export choices offered by Xcode, you'll get the option to export your on-demand resources so that you can host them on a local server for testing, so that you have a more realistic testing scenario as if the resources were being delivered over the network when your app is on the App Store.
When encountering failures to load your resources, make sure you're capturing the error returned by NSBundleResourceRequest when you access the resource. For diagnosing any failures, you may wish to write the error message in the Error to a diagnostic log, such as the system log so that you can retrieve the error details later. If you have the complete error details returned from the API already, feel free to share them here.
— Ed Ford, DTS Engineer