Xcode Previews broken after setting different bundle identifier for debug/release modes

I wanted to be able to install both an App Store/Release version and a development version of my app on the same device and have them access different persistent stores, so I changed the bundle identifier of my app for the debug build configuration to "com.kevinolmats.Guru.debug", while the release configuration stayed as "com.kevinolmats.Guru". Since then, Xcode previews have completely stopped working. After a long build time, the canvas displays Cannot show preview: check whether the preview is compiled for the current scheme and OS of the device used for previewing.

The only things I have changed are:

  • the bundle identifier for the debug configuration
  • the product and bundle names (debug config is now Guru (debug))
  • added a new entitlements file for the debug configuration

Any ideas as to why my previews have stopped working? Enable previews is set to on, and the usual troubleshooting steps (restarting Xcode, my computer, deleting DerivedData) have not helped. The app runs perfectly fine otherwise--it's just previews that are broken.

Hi,

Sorry to hear you are having problems getting previews working. We've attempted to reproduce this, but so far have been unable to do so.

The best next step will be to file a feedback with diagnostics, and ideally a reproducing project, so we can take a look.

Steps to generate helpful diagnostics:

  1. Download and install the logging profile on all devices involved. Instructions and profiles are available here: https://developer.apple.com/bug-reporting/profiles-and-logs/?name=swift
  2. Reproduce the issue
  3. Click the "Diagnostics" button in the error banner in Previews' Canvas area (or if the banner is missing you can use the menu: Editor > Canvas > Diagnostics)
  4. In the sheet that appears, click "Generate Report" in the bottom left of the sheet
  5. Attach (or make from the folder) the resulting zip file to the bug report (will be named something like previews-diagnostics-0123456789.zip)
  6. Generate the sysdiagnose(s) and attach those too

Try

  1. Clean Build.
  2. Restart x-code

This resolved for me the issue :)

Xcode Previews broken after setting different bundle identifier for debug/release modes
 
 
Q