开发者

Problem with beep sound in iPad?

I am using the below code in my app to make a beep sound. Its working in my system iPad simulator (both 4.2 and 4.3). But it not making a beep sound in my iPad iOs 4.2.

my code is:

NSURL *tapSound = [[NSBundle mainBundle] URLForResource:@"BEEPJAZZ" withExtension: @开发者_JAVA百科"WAV"];   
self.soundFileURLRef = (CFURLRef) [tapSound retain];    
AudioServicesCreateSystemSoundID (soundFileURLRef,&soundFileObject);
AudioServicesPlayAlertSound (soundFileObject);


There is nothing wrong in your code. Still try to use following code. From one of my working project.

NSString *tapSoundPath = [[NSBundle mainBundle] pathForResource:@"BEEPJAZZ" ofType:@"WAV"];
self.soundFileURLRef = (CFURLRef) [NSURL fileURLWithPath:tapSoundPath];
AudioServicesCreateSystemSoundID(knifeSoundUrl, &soundFileObject);  
AudioServicesPlayAlertSound (soundFileObject);

Hope it works.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜