0

我是一名新开发人员,想知道如何silent/vibrate通过代码(swift2)来开发 IOS 设备,我不在乎它是否需要私有API。请帮忙。

4

1 回答 1

0

您需要导入系统声音服务

import AudioToolbox.AudioServices

然后就可以播放振动提示“声音”了

AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate))

更多信息可以在 Apple 文档中找到: https ://developer.apple.com/library/prerelease/ios/documentation/AudioToolbox/Reference/SystemSoundServicesReference/index.html

于 2016-01-19T07:27:41.780 回答