Undefined symbols ___llvm_profile_runtime

I was also troubled by the problem. To solve this problem, you may want to add -fprofile-instr-generate to Build Settings > Linking > Other Linker Flags.

This flag is an option used for coverage output. With this setting in my environment, I succeeded in enabling the preview while enabling the coverage.


I got similar ___llvm_profile_runtime_user errors in an Objective-C project.

It was because one of the frameworks used by my app had been built with Code Coverage turned on. (It was built separately, with "Debug" configuration. It was not built by the current project/workspace.)

I made Xcode happy by turning on the same setting in the app's scheme: Edit Scheme -> Test -> Options -> Code Coverage