问题
I've recently tried to include Audiokit 4 in a new project using Xcode 11 and swift 5.1, but I get the error message No such module Audiokit
, the closest I get to Audiokit
is CoreAudiokit
by following the instructions in (https://github.com/audiokit/AudioKit/blob/master/Frameworks/README.md).
Here're the steps I followed:
1) Create new single view project in xcode11
2) Project settings, General tab, Frameworks/Libraries added item Audiokit.framework
3) In the ContentView.swift file: import Audiokit
or import AudioKit
I've doubled checked the release notes and it clearly states support for Xcode 11 (https://github.com/audiokit/AudioKit/releases)
Finally, tried to compile it myself but the same issue as stated above, module not found.
git clone https://github.com/audiokit/AudioKit.git
./build_frameworks.sh
I can see the AudioKit framework under frameworks:
Other linker flags is also set as instructed:
Updated to Xcode 11.4 (latest), same issue.
Also tested moving the audiokit dir, same issue, nothing seems to make it work, so not sure what other people been doing considering the comments in github which seems they use it with Xcode 11.4...
回答1:
After hours trying things, I found a solution! Just have in mind before proceeding that I've updated to the latest (time of writing) Xcode 11.4 and swift 5.2.
I've moved the file from Frameworks / AudioKit.framework to the project:
And then, while selecting the AudioKit.framework
in the show/hide inspector, I change the location to relative to project
and target to the current project name as follows (the name of the project changed to test
in comparison with the earlier or original post version):
Obs: I've also tested by modifying the build settings, removed all subdirectories to exclude in recursive searches extensions; and add the relative path where the audiokit.framework can be found to the framework search paths. The autocomplete works, but I still get the error No such module 'AudioKit'. So, this far the only option that works is the comment before.
--------------------- a few days later ------------------------
Just had a quick look at this and decided to update the report here.
Unfortunately, the fix above removes the "not found" error but the application crashes. Using cocoapods to install audiokit also seems to not cause the "module not found error".
-------------------- weeks later --------------------
Use cocoapods
to include audio into your project as last stated and as follow:
platform :ios, '11.0'
target 'AKRecorder' do
use_frameworks!
pod 'AudioKit', '~> 4.9.5'
end
回答2:
Try changing the "Embed & Sign" setting for the frameworks to "Do Not Embed". The built frameworks are static and while they need to be linked in your project, they should not be embedded since they can't be dynamically loaded.
来源:https://stackoverflow.com/questions/61212246/how-to-include-audiokit-4-in-a-new-project-xcode-11-and-swift-5-1