我使用Audiotoolbox'AudioUnit/AudioUnit.h' 找不到文件
.h文件中
#import <UIKit/UIKit.h>
#import <AudioToolbox/AudioToolbox.h>
@interface ViewController : UIViewController {
}
-(IBAction)buttonPressedWithSound:(id)sender;
@end
,并在.m文件
-(IBAction)buttonPressedWithSound:(id)sender {
int randomSoundNumber = arc4random() % 4; //random number from 0 to 3
NSLog(@"random NR = %i", randomSoundNumber);
NSString *effectTitle;
switch (randomSoundNumber) {
case 0:
effectTitle = @"Come at me BRO!";
break;
default:
break;
}
SystemSoundID soundID;
NSString *soundPath = [[NSBundle mainBundle] pathForResource:effectTitle ofType:@"mp3"];
NSSound *sound = [[[NSSound alloc] initWithContentsOfFile: soundPath byReference: NO] autorelease];
[sound play];
AudioServicesCreateSystemSoundID ((CFURLRef)CFBridgingRetain(soundUrl), &soundID);
AudioServicesPlaySystemSound(soundID);
}
但是当我去跑在我的iPhone上它出现在AUGraph.h日志中,在它的右侧没有找到#include AudioUnit/AudioUnit.h和'AudioUnit/AudioUnit.h'文件。
我该如何解决这个问题在我的手机上运行?
你是什么意思 – 2012-08-10 16:16:24
我认为它已经存在,但我仍然收到错误 – 2012-08-10 16:28:35