Background
I have generated some content using Reality Composer and imported the resulting .rcproject
file into my iOS application in Xcode. Xcode creates a .reality
file that is then loaded onto the App bundle while also auto-generating code to streamline the interface with this file. load<scene name>()
type method is an example of a useful method from the generated code, which returns the specified scene from the .reality
file.
Observations
Invoking the above method synchronously results in the App crashing (and only signalling Thread <thread>: EXC_BREAKPOINT
). The crash occurs at loadAnchor(contentsOf:withName:)
within the load<scene name>()
method. The documentation for this does state that the method "Blocks your app while loading an anchor entity from a file URL", but I don't see why this should result in a crash (I would anticipate unresponsive UI, and this is only if it's being run on the main thread to begin with).
Scheduling this operation on the main queue (via DispatchQueue
or MainActor
) overcomes the above issue. Placing the method within an unstructured Task
does not result in a crash either, but scheduling it on a global
queue results in a crash.
The above behaviour is observed during unit tests as well, but the use of an unstructured Tasks
also results in a crash here.
Versions
While I've listed the respective versions below, I've also experienced this behaviour in prior versions.
- Xcode
13.4.1
- iOS
15.6