我如何循环这段代码:
AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate))
使手机不断振动。
答案 0 :(得分:0)
尝试一下:
func vibrate(current:Int, max: Int) {
AudioServicesPlayAlertSoundWithCompletion(kSystemSoundID_Vibrate) {
if current <= max {
self.vibrate(current: current + 1, max: max)
}
}
}