BLACK FRIDAY: Save 50% on all my Swift books and bundles! >>

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      

Save 50% in my WWDC sale.

SAVE 50% All our books and bundles are half price for Black Friday, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

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.