5

Similar to SwiftUI: Automatic Preview Updating Error "Failed to build ContentView.swift" my code is the same simple SwiftUI code. I can run and compile my code but can't display a preview. For added context my entire project is primarily done with the UIKit framework. I wanted to try having a file with swiftUI code.

== PREVIEW UPDATE ERROR:

LinkDylibError: Failed to build SwiftUIView.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.app/Contents/SharedFrameworks-iphonesimulator'
Undefined symbols for architecture x86_64:
  "___llvm_profile_runtime", referenced from:
      ___llvm_profile_runtime_user in MMMCommonCore(MMMNetworkConditioner-0a5a65b36dec9cde1cfd7accf33679dd.o)
      ___llvm_profile_runtime_user in MMMCommonCore(MMMWeakProxy.o)
      ___llvm_profile_runtime_user in MMMCommonCore(MMMCommonCore-dummy.o)
      ___llvm_profile_runtime_user in MMMCommonCore(MMMCommonCore-3ab87d8094d35167218084cd0a765a4e.o)
      ___llvm_profile_runtime_user in MMMCommonCore(ArrayBuilder.o)
      ___llvm_profile_runtime_user in MMMCommonCore(CommonCore.o)
      ___llvm_profile_runtime_user in MMMCommonCore(MMMTimeSource.o)
      ...
     (maybe you meant: ___llvm_profile_runtime_user)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


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

|  BuildInvocationError

I tried a couple of methods to fix the issue of my SwiftUI view failing to build but none of them worked from https://developer.apple.com/forums/thread/117487, SwiftUI: Automatic Preview Updating Error "Failed to build ContentView.swift".

iceiscold
  • 93
  • 4
  • 1
    does the normal build work for you? can you run your code on simulator? because to me it looks like an issue with your build profile, and not preview. Look up `___llvm_profile_runtime` error - there's a bunch of reasons for it, so likely one of them related to your issue. – timbre timbre Jul 04 '23 at 21:05
  • Yea the solution was to add a couple of linker flags although I don't know how that fixed the issue. – iceiscold Jul 13 '23 at 00:05

0 Answers0