我无法使用静音推送通知在后台调用方法。
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.viewController.sendData()
}
content_available: true
发送推送通知。当app位于前台时,会调用sendData()
。但是在后台,它没有被调用。
答案 0 :(得分:0)
尝试设置time_to_live = 0.它对我有用。