XCode 无法识别引用的 AudioKit 框架 [英] Referenced AudioKit framework is not recognized by XCode

查看:31
本文介绍了XCode 无法识别引用的 AudioKit 框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我创建一个引用(而不是 CocoaPods 等)AudioKit 框架之一的新 XCode 项目时,XCode 不会自动完成 AudioKit 声明并显式声明 AudioKit 对象(例如 AKMIDISampler)会导致构建错误:'AKMIDISampler' 不可用:找不到此类的 Swift 声明.

When I create a new XCode project that references (as opposed to CocoaPods, etc) one of the AudioKit frameworks, XCode does not autocomplete AudioKit declarations and explicitly declaring an AudioKit object (such as AKMIDISampler) results in a build error: 'AKMIDISampler' is unavailable: cannot find Swift declaration for this class.

通常问题在于在 XCode 中正确输入框架搜索路径.然而,即使我为我的目标和我的项目输入了一个相对于框架的路径,我仍然得到相同的结果.

Typically the problem lies in correctly inputting the framework search paths in XCode. However, even though I put in a relative path to the framework for both my target and my project, I still get the same results.

这很可能是所有 3rd 方框架都存在的问题,但我在这里询问 AudioKit,因为我之前在 Google 的 AudioKit 支持小组中看到过这个问题.

It's likely that this is an issue with all 3rd party frameworks, but I am asking it here in reference to AudioKit as I have seen this question come up before in the AudioKit Support group on Google.

设置新项目以使用 AudioKit 以便识别 AudioKit 并自动完成工作的最佳做​​法是什么?

What is the best practice in setting up a new project to use AudioKit so that AudioKit is recognized and autocomplete work?

推荐答案

我已经制定了解决方案并将其发布在这里以供将来参考.

I've worked out the solution and am posting it here for future reference.

以下是使用 AudioKit 进行设置的分步说明.

Here is a step by step to get setup with AudioKit.

注意两点:

  1. 此解决方案是使用 XCode 9.1 发布的.
  2. 此解决方案中使用的 AudioKit 框架是从 http://audiokit.io/downloads 下载的预构建二进制文件/.我已将它们放在一个库文件夹中,距离我保存项目的位置 2 个文件夹.
  1. This solution was posted using XCode 9.1.
  2. The AudioKit frameworks used in this solution are the pre-built binaries downloaded from http://audiokit.io/downloads/. I have placed these in a Libraries folder 2 folders up from where I keep my projects.

步骤:

  1. 在 XCode 中创建一个新项目
  2. 选择适当的目标,然后在 Embedded Binaries 下选择+".选择添加其他..."并导航到正确的 AudioKit 框架.我未选中复制项目",以便在更改时可以在硬盘驱动器上的一个位置更新框架.我还选择了创建组"而不是文件夹引用,但我不确定这是否会影响解决方案.
  3. 选择构建设置并转到框架搜索路径.对于目标,将 $(inherited) 作为您的搜索路径.对于项目,输入 $(SRCROOT)/.对我来说,这看起来像 $(SRCROOT)/../../_Libraries/AudioKit-iOS

现在您可以导入 AudioKit 并且声明应该解析.

Now you can import AudioKit and declarations should resolve.

上面的第 3 步通常是最不正确的地方.许多人期望 SRCROOT 是隐含的,并期望只放入相对路径就足够了,但事实并非如此.必须指定 SRCROOT.

Step 3 above is typically the point most get incorrect. Many expect SRCROOT to be implied and expect that just putting in a relative path is sufficient, but it is not. SRCROOT must be specified.

这篇关于XCode 无法识别引用的 AudioKit 框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆