Xcode 15 beta 7 Previews building issue

Summary

When trying to display SwiftUI previews, building the previews may fail with the following error:

Linking failed: linker command failed with exit code 1 (use -v to see invocation)
    
    ld: warning: search path '/Applications/Xcode.app/Contents/SharedFrameworks-iphonesimulator' not found
    ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found

Note that may app does not use CoreAudioTypes.

Observation

This issue seems to occur when two conditions are met:

  1. The SwiftUI view must be located in a Swift Package
  2. Somewhere in either the View or the #Preview a type from another package has to be used.

Say I have to packages one named Model-package and one named UI-Package. The UI-Package depends on the Model-Package. If I have a SwiftUI view in the UI-Package that uses a type of the Model-Package either in the View itself or in the #Preview, then the described error occurs. If I have a View in the UI-package that does not use a type of the Model-Package anywhere in its View or #Preview then the SwiftUI Preview builds and renders successful.

I created a bug report: FB13033812

Replies

Thanks for the bug report, we'll take a look. Just to clear up one thing: the warning about missing CoreAudioTypes is benign. The real failure is later with missing symbols. This might be a known issue or it might be a new instance of a previously fixed issue. Either way, we'll dig into it.

  • Thank you for your fast response 🙂. Feel free to contact me for more information about the issue, should you need it.

  • Still running into this issue with Widget extensions in Xcode 15 RC / public. Any updates on a fix?

  • Hello,

    i am facing probably the same issue. Updated Xcode on Version 15.0 and the project is not buildable on tvOS. On iOS is all fine.

    ld: warning: ignoring duplicate libraries: '-lc++', '-lz' ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found ld: Undefined symbols: OBJC_CLASS$_UIColorWell, referenced from: in Introspect[7]ViewExtensions.o clang: error: linker command failed with exit code 1 (use -v to see invocation)

I found a workaround in an old thread (https://developer.apple.com/forums/thread/697772) that works for me: To successfully build a preview for a View in a Swift Package, switch to the scheme of the package the view is located in. Thanks to user @derekc00 for pointing it out.

  • Works like a charm. Had to manually create a new Scheme for the Swift Package, but it works. Thanks a lot! :-)

Add a Comment

I am facing the same issue, is this just isolated to XCode 15 betas. The same app and same code run fine in XCode14.2 and .3

I'm also facing a somewhat similar issue - at least as far as the error message is concerned.

https://feedbackassistant.apple.com/feedback/13208223

same for me in XCTest.

If I add Host Application, AND Allow testing Host Application APIs

tests build correctly.

any other combinations, fails.

you can try this,

go to Build Settings > Linking > Other Linker Flags and add -fprofile-instr-generate

  • you are the goat

  • nothing for me.

  • where should we put this? in the test target or the host application or both?

Not sure if this related. My project doesn't need CoreAudioTypes frameworks but it complaints anyway. My project able to build for iOS but throw this similar error for tvOS.

It turns out that 2 of my swift files that are shared between iOS and tvOS, they're importing iOS specific lib. In my case, UIImpactFeedbackGenerator and UISelectionFeedbackGenerator. All I did was to guard the import and implementing with #if os(iOS) and the errors went away.

Seeing similar behavior on both Xcode 15.0.1 RC and Xcode 15.1 Beta. In our case, it's iOS SwiftUI Previews not working at all in SPM package (as opposed to for example an iOS app).

Same code works fine on Xcode 14.x versions.

Edit: Submitted case **** for this alongside diagnostics. Hope it helps, thanks for looking into it @Developer Tools Engineer!

Are you seeing this behavior with views located in your app or located in packages?

I haven’t had this issue since the later Xcode 15 betas. My solution (as described above) is to always switch to a scheme for the app or package the view is located in.

  • Are you seeing this behavior with views located in your app or located in packages?

    Views in packages only.

    The scheme approach does not work for me; the scheme is always the one the view is located in, but it still doesn't work.

    My solution has been creating a "host" app, and previewing the package views in the app instead of from within the package.

Add a Comment

Same thing happend to me on Unity build to Xcode. Im using FirebaseAuth and GoogleSignIn. My project work fine in Xcode 14 but i cant built when update Xcode 15

FirebaseAuth: https://firebase.google.com/docs/auth/unity/google-signin

GoogleSignIn: https://github.com/googlesamples/google-signin-unity

  • Any update on this issue bro ? I have same.

  • Same Problem... Help!

Add a Comment

Any update over this issue I added MessageKit in project and through bridging I am getting the error.

I'm having the same exact issue when building with Xcode 15.0.1:

ld: framework 'CoreAudioTypes' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
  • Same exact error on 15.0.1 as well. The app builds on Xcode, but gives that error when archiving. Worked fine until yesterday, without any major change made in the last day.

  • Same here, just time when I set up new MacBook replacement, got this error when building our project

  • I have the same problem, with Xcode 15.0.1. <code>ld: framework 'CoreAudioTypes' not found clang: error: linker command failed with exit code 1 (use -v to see invocation)</code> But i tried both with the previous version 15 and with the latest 15.1 Beta 2. It's my first attempt at a build and I've never managed to do it.

Add a Comment

I'm seeing the same 'CoreAudioTypes' build error when attempting to run UITests on Xcode 15.0.1

This issue still persists in Xcode 15.1 beta 3, this is really frustrating same code works using Xcode 14.3.1 and it's a shame that I can't update. Just to be clear to me this issue only happens when running unit tests compile the app works fine just the unit tests don't.

Out of the blue this error suddenly popped up on Xcode, release 15.0.1. The error message is bogus for sure. What helped was "Product>Clean Build Folder...", then a rebuild+launch to device!