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

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.

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.

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

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.

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 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)

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!

I'm still experiencing this issue.. Any tips?

The same issue there using the FirebaseAuth 11.3.0 Unity plugin for generating xcworkspace.

I'm seeing the same 'CoreAudioTypes' build error when attempting to run UITests on Version 15.1 beta 3 (15C5059c)

Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found

My app does not use 'CoreAudioTypes'. From what I see, this error message obscures the actual issue in a build.

I saw the same message, but I don't know it is the same problem.

I removed "import AVFoundation" from my app, and other linking errors occurred. I fixed these other linking errors, and the error of "framework 'CoreAudioTypes' not found" was gone.

It was not the 'CoreAudioTypes' framework problem. I think this error message is misleading.

This is so ridiculous. Why does every big build on XCode result in a week of trying to figure out how to make our apps run again. Is there any solution for this yet?

Same here - Unity build to XCode - having only one issue and it's the CoreAudio hiccup...

I am having similar issues. clear derived data doesn't fix it.

Anyone know how to solve it?

I experienced this issue a couple of days ago. The message about "CoreAudioTypes" is completely misleading. In my case, the cause was that while removing some old code I had accidentally deleted a class that was still required. However, the only message that popped up when building was about "CoreAudioTypes" - when I restored the missing class, the message went away and the app built successfully.

You can try hunting around in the build logs for more detail when you see this.

Bottom line: When you see "CoreAudioTypes" it's almost certainly a red herring - you've messed up something else.

Bump - Was there ever a remedy for this? I'm pushing builds out of Unity 2022.3 LTS and having the same errors.

"framework' CoreAudioTypes' not found clang: error: linker command failed with exit code 1 (use -v to see invocation)"

Another bump. This is really frustrating. Reproduced in XCode 15.2 by creating a completely empty, new project. Add "CoreAudioTypes.framework" to the target "Frameworks, Libraries, and Embedded Content" list. Build the app and it fails with the errors...

  • Framework 'CoreAudioTypes' not found
  • Linker command failed with exit code 1 (use -v to see invocation)

Remove the framework and the blank app compiles and runs on the device. No other Apple framework that I tested fails to build in this manner.

Xcode 15 beta 7 Previews building issue
 
 
Q