【问题标题】:AudioServicesPlaySystemSound vibration works but not soundAudioServicesPlaySystemSound 振动有效,但没有声音
【发布时间】:2010-09-24 22:45:58
【问题描述】:

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

【问题讨论】:

    标签: iphone audio vibration


    【解决方案1】:

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

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

    【讨论】:

      【解决方案2】:

      我不会删除声音。我添加了源代码。

      在我重新启动机器和 iPhone 后,它开始在模拟器上运行,但在 iPhone 上却没有。

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-12-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多