Error when trying to use SwiftUI preview

Hi all,

I'm trying to preview a very simple view in a project I have in SwiftUI, and I'm getting this error regardless of the view I'm trying to preview:


----------------------------------------

LinkDylibError: Failed to build PreferencesView.swift

Linking failed: linker command failed with exit code 1 (use -v to see invocation)

ld: warning: directory not found for option '-F/Applications/Xcode-13.3.1.app/Contents/SharedFrameworks-iphonesimulator'
Undefined symbols for architecture x86_64:
  "___asan_init", referenced from:
      _asan.module_ctor in Pods_Remoti(Pods-Remoti-dummy.o)
  "___asan_version_mismatch_check_apple_clang_1316", referenced from:
      _asan.module_ctor in Pods_Remoti(Pods-Remoti-dummy.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

==================================

(I'm attaching the whole error in the post, because it's way too long)

Am I doing something wrong here? Thanks in advance!

Hi,

Sorry to hear you are having problems getting previews working.

Best next step will be to file a feedback with diagnostics and a sample project. We will need the diagnostics Xcode Previews generates in order to make sure we understand the error the previews system is encountering.

Then when you get an error in Xcode Previews, an error banner appears in the canvas

  1. Click the "Diagnostics" button in that banner
  2. In the sheet that appears, click "Generate Report" in the bottom left of the sheet
  3. Attach (or make from the folder) the resulting zip file to the bug (will be named something like previews-diagnostics-0123456789.zip)

Hello @noloman I faced the same issue as well and was searching for an answer for hours until I found a simple one that worked for me:

Just disable Code Coverage for your scheme. From the "Edit Scheme…" window, select Test from the side menu and then choose the Options tab, then uncheck the box for Code Coverage.

This is where I found the answer https://github.com/CocoaPods/CocoaPods/issues/9275#issuecomment-576937202

Error when trying to use SwiftUI preview
 
 
Q