简体   繁体   English

如何在新项目 xcode 11 和 swift 5.1 中包含 Audiokit 4?

[英]How to include Audiokit 4 in a new project xcode 11 and swift 5.1?

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 ). 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 1) 在 xcode11 中创建新的单视图项目

2) Project settings, General tab, Frameworks/Libraries added item Audiokit.framework 2) 项目设置,General 选项卡,Frameworks/Libraries 添加项 Audiokit.framework

3) In the ContentView.swift file: import Audiokit or import AudioKit 3)在ContentView.swift文件中: import Audiokit或者import AudioKit

在此处输入图像描述

I've doubled checked the release notes and it clearly states support for Xcode 11 ( https://github.com/audiokit/AudioKit/releases )我已经仔细检查了发行说明,它清楚地说明了对 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:我可以在frameworks下看到AudioKit框架:

在此处输入图像描述

Other linker flags is also set as instructed:其他 linker 标志也按说明设置:

在此处输入图像描述

Updated to Xcode 11.4 (latest), same issue.更新到 Xcode 11.4(最新),同样的问题。

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...还测试了移动audiokit dir,同样的问题,似乎没有任何效果,所以不确定其他人在考虑github中的评论时在做什么,似乎他们将它与Xcode 11.4一起使用......

在此处输入图像描述

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.构建的框架是 static,虽然它们需要链接到您的项目中,但它们不应该被嵌入,因为它们不能被动态加载。

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.在继续之前请记住,我已更新到最新的(撰写本文时)Xcode 11.4 和 swift 5.2。

I've moved the file from Frameworks / AudioKit.framework to the project:我已将文件从 Frameworks / AudioKit.framework 移至项目:

在此处输入图像描述

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):然后,在显示/隐藏检查器中选择AudioKit.framework时,我将位置更改为relative to project ,并将目标更改为当前项目名称,如下所示(项目名称更改为test与早期或原始帖子相比版本):

在此处输入图像描述

Obs: I've also tested by modifying the build settings, removed all subdirectories to exclude in recursive searches extensions; Obs:我还通过修改构建设置进行了测试,删除了所有子目录以排除在递归搜索扩展中; and add the relative path where the audiokit.framework can be found to the framework search paths.并将可以找到 audiokit.framework 的相对路径添加到框架搜索路径中。 The autocomplete works, but I still get the error No such module 'AudioKit'.自动完成功能有效,但我仍然收到错误 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".使用 cocoapods 安装 audiokit 似乎也不会导致“找不到模块错误”。

-------------------- weeks later -------------------- -------------------- 几周后 --------------------

Use cocoapods to include audio into your project as last stated and as follow:如最后所述,使用cocoapods将音频包含到您的项目中,如下所示:

platform :ios, '11.0'

target 'AKRecorder' do
  use_frameworks!

  pod 'AudioKit', '~> 4.9.5'

end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM