Canvas Preview: Cannot preview in this file

Hi, I want to follow the SwiftUI tutorials from Apple Developer. After creating the “Landmarks” app and clicking on ContentView, the preview shows:

Cannot preview in this file
Failed to launch net.bayerthomas.Landmarks

with the Diagnostics:

== PREVIEW UPDATE ERROR:

    FailedToLaunchAppError: Failed to launch net.bayerthomas.Landmarks
    
    ==================================
    
    |  [Remote] JITError
    |  
    |  ==================================
    |  
    |  |  [Remote] CouldNotLoadInputObjectFile: Could not load object file during preview: /Users/thomas/Library/Developer/Xcode/DerivedData/Landmarks-gpfsfizlhntsahandeumxmhwbjfj/Build/Intermediates.noindex/Landmarks.build/Debug-iphonesimulator/Landmarks.build/Objects-normal/arm64/ContentView.1.preview-thunk-launch.o
    |  |  
    |  |  path: /Users/thomas/Library/Developer/Xcode/DerivedData/Landmarks-gpfsfizlhntsahandeumxmhwbjfj/Build/Intermediates.noindex/Landmarks.build/Debug-iphonesimulator/Landmarks.build/Objects-normal/arm64/ContentView.1.preview-thunk-launch.o
    |  |  
    |  |  ==================================
    |  |  
    |  |  |  [Remote] XOJITError
    |  |  |  
    |  |  |  XOJITError: '/Users/thomas/Library/Developer/Xcode/DerivedData/Landmarks-gpfsfizlhntsahandeumxmhwbjfj/Build/Intermediates.noindex/Landmarks.build/Debug-iphonesimulator/Landmarks.build/Objects-normal/arm64/ContentView.1.preview-thunk-launch.o': No such file or directory

I am on a fresh install of Xcode 16.3 on macOS 15.4.1.

Why is the official tutorial from Apple not working?

Hi @thomasbayer

Could you give me some more information? Which simulator are you using? It should say in the lower left hand corner of the preview.

I was able to reproduce the error and fixed it by:

  • adding a code signing team
  • Going to ContentView, commenting out the MapView and the CircleImage view
  • Changing the simulator to iPad.

It seems like it could be an issue with the simulator itself. It'd help if you could file a feedback report at https://feedbackassistant.apple.com and put the FB number here to look into the iPhone simulator working as well.

Thank you!

Canvas Preview: Cannot preview in this file
 
 
Q