Xcode preview crash continuously

Hi.

Just update my MacBook Pro M1 with sequoia and Xcode and I got huge problem with preview on simply swiftui pages. This is the full report I got when the preview crash but if I run the app on the device or the simulator it works fine. How can I solve this situation?

the crashing thread is number 6 which reports this:

Thread 6 Crashed::  Dispatch queue: com.apple.root.user-initiated-qos
0   XOJIT                         	       0x240b899f8 llvm::Error llvm::detail::UniqueFunctionBase<llvm::Error, llvm::jitlink::LinkGraph&>::CallImpl<xojit::ReplacementManager::Plugin::modifyPassConfig(llvm::orc::MaterializationResponsibility&, llvm::jitlink::LinkGraph&, llvm::jitlink::PassConfiguration&)::'lambda'(llvm::jitlink::LinkGraph&)>(void*, llvm::jitlink::LinkGraph&) + 1784
1   XOJIT                         	       0x240c1b46c llvm::jitlink::JITLinkerBase::runPasses(std::__1::vector<llvm::unique_function<llvm::Error (llvm::jitlink::LinkGraph&)>, std::__1::allocator<llvm::unique_function<llvm::Error (llvm::jitlink::LinkGraph&)>>>&) + 76
2   XOJIT                         	       0x240c1ab68 llvm::jitlink::JITLinkerBase::linkPhase1(std::__1::unique_ptr<llvm::jitlink::JITLinkerBase, std::__1::default_delete<llvm::jitlink::JITLinkerBase>>) + 72
3   XOJIT                         	       0x240c2158c llvm::jitlink::link_MachO_arm64(std::__1::unique_ptr<llvm::jitlink::LinkGraph, std::__1::default_delete<llvm::jitlink::LinkGraph>>, std::__1::unique_ptr<llvm::jitlink::JITLinkContext, std::__1::default_delete<llvm::jitlink::JITLinkContext>>) + 3608
4   XOJIT                         	       0x240c20400 llvm::jitlink::link_MachO(std::__1::unique_ptr<llvm::jitlink::LinkGraph, std::__1::default_delete<llvm::jitlink::LinkGraph>>, std::__1::unique_ptr<llvm::jitlink::JITLinkContext, std::__1::default_delete<llvm::jitlink::JITLinkContext>>) + 72
5   XOJIT                         	       0x240c19cc8 llvm::jitlink::link(std::__1::unique_ptr<llvm::jitlink::LinkGraph, std::__1::default_delete<llvm::jitlink::LinkGraph>>, std::__1::unique_ptr<llvm::jitlink::JITLinkContext, std::__1::default_delete<llvm::jitlink::JITLinkContext>>) + 80
6   XOJIT                         	       0x240c0acc0 llvm::orc::ObjectLinkingLayer::emit(std::__1::unique_ptr<llvm::orc::MaterializationResponsibility, std::__1::default_delete<llvm::orc::MaterializationResponsibility>>, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>) + 256
7   XOJIT                         	       0x240bfcbfc llvm::orc::BasicObjectLayerMaterializationUnit::materialize(std::__1::unique_ptr<llvm::orc::MaterializationResponsibility, std::__1::default_delete<llvm::orc::MaterializationResponsibility>>) + 60
8   XOJIT                         	       0x240be3f08 llvm::orc::MaterializationTask::run() + 44
9   XOJIT                         	       0x240b97e1c invocation function for block in (anonymous namespace)::GCDTaskDispatcher::dispatch(std::__1::unique_ptr<llvm::orc::Task, std::__1::default_delete<llvm::orc::Task>>) + 108
10  libdispatch.dylib             	       0x1801774ec _dispatch_call_block_and_release + 24
11  libdispatch.dylib             	       0x180178de0 _dispatch_client_callout + 16
12  libdispatch.dylib             	       0x18018b864 _dispatch_root_queue_drain + 1208
13  libdispatch.dylib             	       0x18018bf60 _dispatch_worker_thread2 + 232
14  libsystem_pthread.dylib       	       0x104db7b38 _pthread_wqthread + 224
15  libsystem_pthread.dylib       	       0x104db6934 start_wqthread + 8

Answered by Developer Tools Engineer in 804526022

Hi,

Sorry to hear you are having problems getting previews working with an iOS 18 device.

Thanks for including the crash report. This shows that you are hitting a known issue.

Another workaround you can in the try is in the Xcode main menu turn on Editor > Canvas > Use Legacy Execution

quick update: if I choose a device with iOS 17 instead of ios18 the preview doesn't crash

Accepted Answer

Hi,

Sorry to hear you are having problems getting previews working with an iOS 18 device.

Thanks for including the crash report. This shows that you are hitting a known issue.

Another workaround you can in the try is in the Xcode main menu turn on Editor > Canvas > Use Legacy Execution

It persists in the Xcode release as well.

I confirm that any iOS 18 Simualtor that is used for Preview will crash with no reason. If I run the app normally in the Simulator, it works just fine.

My solution was to go to Window -> Devices and Simulators -> click + -> add an iOS 17.5 device. Then in the preview window, select that device.

Shameful problem

I tried to set it on iOS 17.5 and also used Legacy Previews Execution, no luck

The crash seems to be somewhat different, since once I set it on Legacy Previews Execution it starts giving me an error on 3rd party dependencies: Missing required modules: 'FirebaseCore', 'FirebaseCrashlytics'

The error I get when PreviewShell crashes is attached to this comment, maybe someone finds it helpful. Thanks!

Xcode preview crash continuously
 
 
Q