Xcode 13 preview failed - The project does not contain a preview provider named "ContentView_Previews_", etc.

Hi folks,

I downloaded the Xcode 13 and created a new project, named 2021107. After launching the program and without writing any code, the preview failed in the very beginning as shown in fig1.png. The error message shows the project '20211007' does not contain a preview provider named "ContentView_Previews_". It asks me to check the build settings to ensure the preview provider is compiled to the product. Since I'm a beginner in the Xcode, I'm sorry I'm not sure where the settings are and what to do to fix it. I click on the 'Try Again' to rebuild the preview and it failed again. I used to use the Xcode 12 to study the Swift language and I remember the Preview showed the 'Hello world' after launching the program. It seems the Xcode 13 is different. I'd be much obliged if anyone would help me with the problem. Thanks in advance!

Additional information:

[1] When I clicked on 'build', it succeeded. The simulator was launched without any error.

[2] Fig2 shows the message when I clicked on 'Diagnostics' next to the 'Try Again' on the preview panel.

Sorry to hear you are having problems getting previews working. Best next step will be to file a feedback with diagnostics. We will need the diagnostics Xcode Previews generates in order to make sure we understand the error the previews system is encountering.

  1. When you get an error in Xcode Previews, an error banner appears in the canvas
  2. Click the "Diagnostics" button in that banner
  3. In the sheet that appears, click "Generate Report" in the bottom left of the sheet
  4. Attach (or make from the folder) the resulting zip file to the bug (will be named something like previews-diagnostics-0123456789.zip)

Report back here with the feedback ID and I'll make sure it gets looked at as soon as possible!

Thanks for attempting to send us the diagnostic. I have actually found a dupe of your issue internally. The workaround is to rename the project such that the targets don't start with a digit. So 123Foo does not work, but Foo123 should work fine.

Sorry for any inconvenience caused!

Thanks for helping!

Have exactly the same error - project broke unexpectedly. Have tried another one by copy and pasting *.swift files content, and _at_some_point preview stopped working.

Even after deletion almost all of "create" content, leaving just one simple View the error is still there.

Xcode 13 preview failed - The project does not contain a preview provider named "ContentView_Previews_", etc.
 
 
Q