0
我是一個新的開發人員,想知道如何通過代碼(swift2
)IOS設備silent/vibrate
,我不在乎它是否需要私人 API。請幫忙。以編程方式沉默/使用swift2振動iOS設備?
我是一個新的開發人員,想知道如何通過代碼(swift2
)IOS設備silent/vibrate
,我不在乎它是否需要私人 API。請幫忙。以編程方式沉默/使用swift2振動iOS設備?
你需要導入系統聲音服務
import AudioToolbox.AudioServices
然後你就可以玩振動警報「聲音」
AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate))
更多信息可以在蘋果的文檔中找到: https://developer.apple.com/library/prerelease/ios/documentation/AudioToolbox/Reference/SystemSoundServicesReference/index.html