Ios 振动背景位置警报?

Ios 振动背景位置警报?,ios,swift,notifications,iphone-vibrate,Ios,Swift,Notifications,Iphone Vibrate,我试着用这个方法 AudioServicesPlayAlertSound(kSystemSoundID_Vibrate) AudioServicesPlaySystemSound(kSystemSoundID_Vibrate) func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { } 在使用该方法时触发振动 AudioServicesPlayAlert

我试着用这个方法

AudioServicesPlayAlertSound(kSystemSoundID_Vibrate)
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
 func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
}
在使用该方法时触发振动

AudioServicesPlayAlertSound(kSystemSoundID_Vibrate)
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
 func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
}
被称为

然而,我发现振动永远不会被触发,除非应用程序在前台


有什么方法可以做到这一点吗?

您是否添加了导入框架,因为z已经导入了所有必要的库。当应用程序位于前台时,它就会工作。看到这个了吗