Referenced AudioKit framework is not recognized by XCode

怎甘沉沦 提交于 2019-12-10 14:33:40

问题


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.

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.

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.

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


回答1:


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

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

Two things to note:

  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.

Steps:

  1. Create a new project in XCode
  2. Select the appropriate target and under Embedded Binaries, select the '+'. Choose 'Add Other...' and navigate to the correct AudioKit framework. I leave 'Copy Items' unchecked so that I can update the framework in one location on my hard drive when it changes. I also select 'Create groups' instead of folder references, but I'm not sure that plays into the solution.
  3. Select Build Settings and go to the Framework Search Paths. For the target, put $(inherited) for your search path. For the project, put $(SRCROOT)/. For me this looks like $(SRCROOT)/../../_Libraries/AudioKit-iOS

Now you can import AudioKit and declarations should resolve.

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.



来源:https://stackoverflow.com/questions/47273149/referenced-audiokit-framework-is-not-recognized-by-xcode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!