Hi all, I am trying to ensure that my code works correctly when updating asset packs. It appears to be more of a hassle than I expected, so I am not sure whether I am missing something.
My question broadly is, how is the update flow expected to work, during development and during production?
More specifically:
- Are we generally expected to let the system run the update?
- Will it update while the app is running and can it interfere somehow (see next point)?
- When serving with
xcrun ba-serve --asset-pack-versions, is a call tocontents(at:searchingInAssetPackWithID:options:)after updating a pack withensureLocalAvailability(of: ..., requireLatestVersion: true)expected to work? For me it almost always throws an "Operation not permitted" error with "The file ... couldn’t be opened because you don’t have permission to view it.". Repeated delayed attempts also throw. I can see from the status update that the download completes before I callcontents(at:searchingInAssetPackWithID:options:)and when I check the daemon container contents I can see that the pack has been downloaded & extracted and the file I tried to get the contents of is there. It does work after I quit and relaunch the app. This is both on the macOS dev machine and on an iOS device.
I also tried to use the Xcode 27 run scheme option to serve asset packs from a folder. It looks a lot more convenient than going through the certificate hoops for testing with xcrun ba-serve. Unfortunately, I cannot find an equivalent of --asset-pack-versions and the Xcode machinery does not appear to detect changes in the packs to bump versions automatically.
How is this supposed to work? Is there a way to bump versions manually in order to test pack updates with the Xcode 27 scheme option? Is there a way to properly purge the local asset pack storage during development? I mean outside the app, not programmatically.
If not, it appears that with the Xcode 27 scheme option, I can only add packs, never change any without deleting them in the app first. I tried to delete the Daemon Container directory that stores the downloaded packs on macOS. It worked once in that the app was able to download the updated packs afterwards into a fresh daemon container. The other times I tried, however, it was stuck. While a new daemon container showed up, packs were downloaded into the "Asset Packs" folder next to the Manifest.json but the .aar just sat there unextracted so it was not possible anymore to access any pack content in the app. Only a system restart fixed it. I also tried to kill some of the processes that sound like they belong to the background asset machinery, but that didn't fix anything.