Objective c 找不到“AudioUnit/AudioUnit.h”文件

Objective c 找不到“AudioUnit/AudioUnit.h”文件,objective-c,ios,xcode,Objective C,Ios,Xcode,我正在使用音频工具箱 .h文件 #import <UIKit/UIKit.h> #import <AudioToolbox/AudioToolbox.h> @interface ViewController : UIViewController { } -(IBAction)buttonPressedWithSound:(id)sender; @end 但是,当我在iphone上运行时,日志中出现了AUGraph.h中的include AudioUnit/Aud

我正在使用音频工具箱

.h文件

#import <UIKit/UIKit.h>
#import <AudioToolbox/AudioToolbox.h>

@interface ViewController : UIViewController {

}

-(IBAction)buttonPressedWithSound:(id)sender;

@end
但是,当我在iphone上运行时,日志中出现了AUGraph.h中的include AudioUnit/AudioUnit.h和'AudioUnit/AudioUnit.h'文件,但在其右侧找不到


如何修复此问题以在手机上运行它?

在构建阶段将audiotoolbox框架添加到应用程序中…链接库

在构建阶段将audiotoolbox框架添加到应用程序中…链接库

如stackmonster所说,确保其在构建阶段>将二进制文件链接到库 你还需要把它包括在你想用它的课堂上,也许你也可以试着包括audioUnit,但不明白为什么你也要这么做

你也可以尝试使用AVAudioPlayer,这对你来说可能更容易,我知道这对我来说很难

AVAudioPlayer *theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:NULL];

theAudio.volume = 1.0;

theAudio.delegate = self;

[theAudio prepareToPlay];

[theAudio play];

正如stackmonster所说,确保其处于构建阶段>将二进制文件链接到库中 你还需要把它包括在你想用它的课堂上,也许你也可以试着包括audioUnit,但不明白为什么你也要这么做

你也可以尝试使用AVAudioPlayer,这对你来说可能更容易,我知道这对我来说很难

AVAudioPlayer *theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:NULL];

theAudio.volume = 1.0;

theAudio.delegate = self;

[theAudio prepareToPlay];

[theAudio play];

所以我把它放在了.m文件中,那么.h文件呢?修复方法是什么?AVAudioPlayer还是其中一个导入?很高兴它帮助了我,不管它是哪一个,虽然它是修复的,但现在当我把你的代码放在.m文件中时,错误像未知类型名一样弹出,是在.h文件中出现的吗?所以我把它放在.m文件中,那么.h文件呢?修复了什么?AVAudioPlayer还是其中一个导入?很高兴它帮助了我,不管它是哪一个,虽然它被修复了,但是现在当我把你的代码放在.m文件中时,错误像未知类型名一样突然出现,是在.h文件中吗?