0
アプリケーションがサイレントプッシュを受信するたびに、ローカル通知を表示しています。 サイレントプッシュを受信したときにiPhoneがロックされている場合、ローカル通知が表示されますが、アプリケーションがバックグラウンドで、iPhoneがロックされていないとローカル通知が表示されません。何が間違っているかもしれない。 ?私は以下のコードを使用していますか?UILocalNotificationはロック画面/通知画面にのみ表示されます
let content = UNMutableNotificationContent()
content.title = "Connect"
content.body = indentificationText
content.sound = UNNotificationSound.default()
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 1,
repeats: false)
let appDelegate = UIApplication.shared.delegate as! AppDelegate
UNUserNotificationCenter.current().delegate = appDelegate
content.userInfo = payload.dictionaryPayload
let request = UNNotificationRequest(identifier: content.title, content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request, withCompletionHandler: { (error) in
NSLog("UNUserNotificationCenter Add completion Handler : \(String(describing: error?.localizedDescription))")
})