-1

AudioServicesPlaySystemSound 不做任何事情,但 AudioServicesPlayAlertSound 使 iPhone 振动。

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);
4

2 回答 2

1

显示一些代码会有所帮助。

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

于 2010-09-24T23:05:10.670 回答
0

I'm not deleting the sound. I added the source code.

After I rebooted both my machine and the iPhone, it started working on the simulator but not on the iPhone.

It worked once on the iPhone. I'm testing with a new project with just the create and play sound in it.

于 2010-09-25T16:49:15.450 回答