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.

  • 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.

Add a Comment

Replies

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!

  • Dear Sir, thank you for your reply! I followed your instruction and it helped to generate a report, named "previews-diagnostics-20211008-011503", in my Finder. I compressed it to a zip file which has a size of 72.3 MB. I first tried to attach it here by use of "Add File" but when choosing the file to upload the file name appeared to be gray and not clickable. I thought it might be the problem of the size so I compressed each individual file contained in the folder and tried to upload them separately. Again, the files appear to be gray and not clickable (cannot be attached). I'm wondering if I may send them to you through email, please. Here's my email address: snailcapital @ icloud.com

    I would appreciate it. Thank you!

Add a Comment

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!

  • Hi there! And how about the case when project doesn't start with digits, but exactly the same error appeared out of thin air, spontaneously? I mean previews were working all the time, but suddenly exactly the same error message appeared.

    I have tried to rename the project, scheme, use another machine, reinstall Xcode and macOS. Nothing works for this project preview anymore. Any suggestions?

    https://1drv.ms/u/s!AkHh5jFVwlewsEIK1lcFe5i8bJHt?e=ZsP4oL

    Appreciate your help, time and expertise !

    Best Regards, Sergey

  • Project name however is in Cyrillic, but it was always that, while the problem appeared just 2 days ago, out of nowhere

Add a Comment

Thanks for helping!