UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SOLVED: "Cannot load underlying module for 'AVFoundation'" Xcode error

Forums > iOS

Recently, I started coding with Xcode (I used to code with Swift Playgrounds on my iPad), and now I'm attempting to make a SwiftUI app that uses AVFoundation and camera to let the user take pictures of animals. The purpose of the app is to identify the photographed animals, using machine learning.

In Swift Playgrounds, when I wanted to use a framework, the only thing I had to do is to add "import framework name" above my code. However, if I do that in Xcode with the AVFoundation framework, Xcode throws this error: "Cannot load underlying module for 'AVFoundation'". This probably is some sort of rookie mistake, but I'm new to Xcode, so please forgive me. 😉

I already added the framework to the "Link Binary With Libraries" section (Project -> Build Phases -> Link Binary With Libraries), but this doesn't get rid of the error. What else should I do in order to use AVFoundation?

Update: the error was thrown when I tried to run the app on my iPhone 8. (It doesn't run in simulator, because it uses camera)

3      

I think that you have enabled the Show live issues, or it has been enabled for you automatically, if just you have just installed the latest Xcode v14.3.1 I say this because I had the same issue with AVFoundation and AVKit.

Checking if it is an issue with the latest Xcode, or it has been there for sometime if you enable Show live issues, and AVFoundation/ AVKit have a hidden non-error.

Anyway, in my case the audio worked fine in the app, so it was just the error message being displayed that was the issue.

Try this.

In the Xcode menu bar, find Settings\General. After the Appearance and Issues options there should be Show live issues. Deselect it, and see if that helps.

At least it should suppress live error reporting. Check that your app (still) works.

4      

Thank you, @Greenamberred, the error doesn't show up anymore now.

3      

Hacking with Swift is sponsored by RevenueCat

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.