实现该功能非常简单,只需要导入AudioToolbox.framework包,然后再需要使用的地方调用以下代码即可。
AudioToolbox.framework
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)