Main Camera Access on Vision OS

Hello, I have received Enterprise.license from Apple and I am trying to implement main Camera access for Vision Pro by following https://developer.apple.com/videos/play/wwdc2024/10139/. Here is my camera function.

func takePicture() async { let formats = CameraVideoFormat.supportedVideoFormats(for: .main, cameraPositions:[.left]) let cameraFrameProvider = CameraFrameProvider()

    var arKitSession = ARKitSession()
    var pixelBuffer: CVPixelBuffer?
    
    await arKitSession.queryAuthorization(for: [.cameraAccess])
    
    do {
        try await arKitSession.run([cameraFrameProvider])
    } catch {
        return
    }
    
    guard let cameraFrameUpdates =
        cameraFrameProvider.cameraFrameUpdates(for: formats[0]) else {
        return
    }
    
    for await cameraFrame in cameraFrameUpdates {
        guard let mainCameraSample = cameraFrame.sample(for: .left) else {
            continue
        }
        pixelBuffer = mainCameraSample.pixelBuffer
        let image = UIImage(ciImage: CIImage(cvPixelBuffer: pixelBuffer!))
        print(image)
        UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil)
        
    }
}

}

My problem is debug stops at this line. guard let cameraFrameUpdates = cameraFrameProvider.cameraFrameUpdates(for: formats[0]) else { return }

Why does it happen so and what else do I need to do?

Please some Apple Dev answer ! I am having the same issue.

Main Camera Access on Vision OS
 
 
Q