Unable to present a Programmatic Immersive View for id after initial open and dismiss.

It seems as though when loading up an ImmersiveView that the View itself is programatic (not using Reality Composer file), after the initial dismiss.... you can no longer load it up again? I'm honestly a bit lost here and hoping someone ran into the same and found an answer. I've confirmed this issue doesn't exist with Reality Composer file content from what I can tell.

While digging around trying to find examples of doing it properly, I realized that this Apple provided demo source (https://developer.apple.com/documentation/visionos/incorporating-real-world-surroundings-in-an-immersive-experience) has the exact same issue I'm trying to chase down if anyone wants to take a peak.

Open that project, Comment out line 32 of ContentView (dismissWindow()), and run it. You'll notice the Toggle is all wired up correctly already but the issue was hidden by dismissing the view, however after toggling off and on for a second time it will fail on "Unable to present an Immersive Space (id: 'string("CubeMeshInteraction")')"

Seems I’m not the only one hitting this, all the references I find online are unanswered however...

https://forums.developer.apple.com/forums/thread/747507

https://stackoverflow.com/questions/78064275/unable-to-present-an-immersive-space-for-id-error-domain-fbsworkspaceerrordomai

I feels like maybe it has something to do with a programmatically set ID string that persists past first open I think? So it’s opening into an id that already exists maybe? But I cannot figure out what is actually modifiable to fix this behavior and I’ve spent far too much time trying to chase something this dumb today.

I'm having a hard time believing I'm one of the first people to discover this, but resources are literally zero on this issue and I've come to a dead end.

Any help is greatly appreciated

Hello @MikeBundy,

Are you testing that sample code on Simulator? If so, it is expected that it will dismiss its ImmersiveSpace as soon as it is opened (because dataProvidersAreSupported will be false).

I'm not certain that the sample code is demonstrating the same problem you are having, can you provide a focused sample project that demonstrates your issue? Then I can take a look to see what the issue may be.

It seems as though when loading up an ImmersiveView that the View itself is programatic (not using Reality Composer file), after the initial dismiss.... you can no longer load it up again?

Generally speaking, this is not the case, you should be able to dismiss and the re-open the immersive space, so this issue is likely specific to your code.

I can confirm I'm testing on a real Vision Pro, with VisionOS 1.1, Newest Xcode.

If you download that Scene Reconstruction Demo provided by Apple, and comment out the dismissWindow as my initial post talks about, you'll see the exact same error I'm experiencing when clicking the Toggle off and back on again to load the View for the second time.

"Unable to present an Immersive Space (id: 'string("CubeMeshInteraction")')"

Thank you!

Unable to present a Programmatic Immersive View for id after initial open and dismiss.
 
 
Q