Whenever I try to use SwiftUI previews, the preview fails with a CouldNotLoadInputObjectFile
error like this:
== PREVIEW UPDATE ERROR:
FailedToLaunchAppError: Failed to launch com.my-company.Test
| ==================================
| | [Remote] CouldNotLoadInputObjectFile: Could not load object file during preview: /Users/me/Library/Developer/Xcode/DerivedData/Test-dzmdthicvcbuwkawncuacsomcdcd/Build/Intermediates.noindex/Test.build/Debug-iphonesimulator/Test.build/Objects-normal/arm64/TestApp.o
| |
| | path: /Users/me/Library/Developer/Xcode/DerivedData/Test-dzmdthicvcbuwkawncuacsomcdcd/Build/Intermediates.noindex/Test.build/Debug-iphonesimulator/Test.build/Objects-normal/arm64/TestApp.o
| |
| | ==================================
| | | [Remote] XOJITError
| | |
| | | XOJITError: '/Users/me/Library/Developer/Xcode/DerivedData/Test-dzmdthicvcbuwkawncuacsomcdcd/Build/Intermediates.noindex/Test.build/Debug-iphonesimulator/Test.build/Objects-normal/arm64/TestApp.o': No such file or directory
It appears that the preview process cannot find the compiled .o
files. However, when I check in Finder, the files do exist and normally running the app works fine.
It is noteworthy that this is independent of the XCode project or view I try to preview. It is a global issue on my system. Previews not even work when I create a blank new SwiftUI project in XCode.
I tried deleting all caches, derived data, preview caches etc. But without any effect. I have this in XCode 16.3 as well as in 16.4 RC. On macOS Sequoia 15.4.1 on a MacBook Air M4.
Does anybody have an idea what might be causing this?