2010-09-24 487 views
-1

AudioServicesPlaySystemSound除了AudioServicesPlayAlertSound之外不会做任何事情,使iPhone振动。AudioServicesPlaySystemSound振动有效,但没有声音

AudioServicesCreateSystemSoundID返回成功。我正在开发运行iOS4的iPhone3G。

任何想法? 彼得

=====

下面是如何创建的声音:

NSString *sndPath = [[NSBundle mainBundle] pathForResource:@"first_touch" ofType:@"wav" inDirectory:@"/"]; 
CFURLRef sndURL = (CFURLRef)[[NSURL alloc] initFileURLWithPath:sndPath]; 
int e = AudioServicesCreateSystemSoundID(sndURL, &_firstTouch); // TODO: call 'AudioServicesDisposeSystemSoundID' 

这就是我玩谁:

AudioServicesPlayAlertSound(_firstTouch); 

回答

1

显示一些代码帮助。

猜测,您正在创建声音,播放声音,然后立即删除声音。这不起作用;删除声音会导致它停止播放。

0

我没有删除声音。我添加了源代码。

重新启动我的机器和iPhone之后,它开始在模拟器上工作,但不在iPhone上。

它曾经在iPhone上工作过一次。我正在测试一个只有创建和播放声音的新项目。