我使用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