Program runs fine in Vision Pro simulator but not on the actual device

We are encountering an issue with our app on Vision Pro with OS version 1.3. The app runs perfectly in the VisionOS Simulator, but when tested on the actual device, no content is displayed.

Here’s the expected behavior: When the app launches, a video should play in a window. Once the video ends, another information window should open. After a series of these information windows, we will load to an immersive space to handle 3D elements.

We've set the "Preferred Default Scene Session Role" to "Window Application Session Role" in info.plist, but the issue persists.

Below is the code we're using. Any advice or suggestions would be greatly appreciated.

import SwiftUI

@main
struct myApp: App {
    
    @StateObject var sharedData = SharedDataModel()
    @State private var isFactoryEnabled = false


    var body: some Scene {
        
        WindowGroup(id: "LaunchScreen", content: {
            LaunchScreen()
                
        })
        .windowStyle(.plain)
        .environmentObject(sharedData)
        
        WindowGroup(id: "LoginView", content: {
            ZStack {
                let _ = UserDefaults.standard.set(false, forKey: "_UIConstraintBasedLayoutLogUnsatisfiable")
                let _ = print(FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!.path)
                
                    LoginView()
                }
        }).windowStyle(.plain)
        .environmentObject(sharedData)
        
        WindowGroup(id: "TrainingSelection", content: {
            
                if !sharedData.showNavigationHintView{
                    NavigationHintView()
                        .glassBackgroundEffect()
                        .cornerRadius(30)
                    
                }
                else {
                    TrainingSelection()
                }

        }).windowStyle(.plain)
        .environmentObject(sharedData)
        
        WindowGroup(id: "Salutations", content: {
            Salutations()
        }).windowStyle(.plain)
        .environmentObject(sharedData)
        
        WindowGroup {
            ContentView()
        }
        .environmentObject(sharedData)

        ImmersiveSpace(id: "myImmersiveSpace") {
            ImmersiveView(viewModel: .init())
        }
        .environmentObject(sharedData)
    }
}

import SwiftUI
import AVFoundation
import RealityKit
import RealityKitContent

struct LaunchScreen: View {
    @State private var player: AVPlayer?
    @State private var navigateToContentView = false
    @EnvironmentObject var audioPlayer: AudioPlayer

    var body: some View {
        ZStack {

            ZStack {
                if navigateToContentView {
                    WarningView()
                        .transition(.opacity)
                        .glassBackgroundEffect()
                        .cornerRadius(15)
                } else {
                    if let player = player {
                        AVPlayerView(player: player)
                            .onAppear {
                                player.play()
                                addObserver()
                            }
                            .cornerRadius(30)
                    } else {
                        Text("Unable to Load the Video")
                            .foregroundColor(.white)
                            .onAppear {
                                loadVideo()
                            }
                    }
                }
            }
            .edgesIgnoringSafeArea(.all)
            .animation(.easeIn, value: 1)
        }
        .glassBackgroundEffect()

    }

    private func loadVideo() {
        if let videoUrl = Bundle.main.url(forResource: "launchScreen", withExtension: "mp4") {
            player = AVPlayer(url: videoUrl)
        } else {
            print("Unable to Load the Video")
        }
    }

    private func addObserver() {
        NotificationCenter.default.addObserver(
            forName: .AVPlayerItemDidPlayToEndTime,
            object: player?.currentItem,
            queue: .main
        ) { _ in
            self.navigateToContentView = true
        }
    }
}

Hey @eBramha,

This is certainly an interesting bug. What exactly do you mean by no content is displayed? Is your application launching or is the screen going completely dark? Have you tried replicating this issue on visionOS 2.0?

Can you open a bug report, including a small project that causes this behavior and a video of what you are encountering, and post the FB number here once you do. Bug Reporting: How and Why? has tips on creating your bug report.

Thanks!

Program runs fine in Vision Pro simulator but not on the actual device
 
 
Q