Access Main Camera not working in VisionOS 26.1

I downloaded the official sample project “Accessing the Main Camera”, but I found that it’s not able to retrieve the camera feed on visionOS 26.1. After checking the debug logs, it seems the issue is caused by the system being unable to find the expected format.

I tested on a device running visionOS 2, and the camera feed worked correctly — but only when using the sample code from the visionOS 2 version, not the current one. I also noticed that some of the APIs have changed between versions.

Has anyone managed to successfully access the camera feed on visionOS 26.1?

Answered by Vision Pro Engineer in 866043022

Hi @Ewan_Ke

The sample app requires a valid license file to display the main camera. Can you confirm you replaced the placeholder Enterprise.license file with your valid Enterprise.license file?

Accepted Answer

Hi @Ewan_Ke

The sample app requires a valid license file to display the main camera. Can you confirm you replaced the placeholder Enterprise.license file with your valid Enterprise.license file?

Hi @Ewan_Ke

I am unable to reproduce the behavior using visionOS 26.1. I'd appreciate it if you file a bug report using feedback assistant, attach a sysdiagnose, and post the FB number here once you do.

Bug Reporting: How and Why? has tips on creating your bug report.

Hi @Ewan_Ke

Following up. Are you still experiencing this issue?

Hi @Ewan_Ke

Thanks for the reply. We pushed a small refactor to the sample yesterday. Here's the diff. I recommend applying the changes. It's worth calling out that the changes would not cause the behavior you reported, but they will make your app better.

Changes Summary

This patch addresses camera feed handling and removes unnecessary scene phase restart logic.

Files Modified

1. CameraFeed.swift

  • Added flush check before processing sample buffers to prevent decoding issues
if preview.sampleBufferRenderer.requiresFlushToResumeDecoding {
    preview.sampleBufferRenderer.flush()
}

2. CameraSessionManager.swift

  • Changed restart() method visibility to private
    • Was: func restart() async
    • Now: private func restart() async

3. MainCameraView.swift

  • Removed unused @Environment(\.scenePhase) property
  • Removed .onChange(of: scenePhase) modifier that was calling sessionManager.restart() when returning from background

Rationale

Restarting CameraSessionManager after the app is backgrounded is excessive. Instead the code should flush the sampleBufferRenderer if necessary.

Access Main Camera not working in VisionOS 26.1
 
 
Q