iOS 10 の Swift 3 でアプリを実行しています。アプリで呼び出しをシミュレートするために UNNotificationContent を実行しましたが、起動後約 5 秒で消えます。「呼び出し」が進行している間、それをさらに数秒保持する必要があります。removeAllPendingNotificationRequests メソッドを呼び出すまで、ローカル通知を保持したいと考えています。私はそれを行うことができますか?
これは私のコードです:
let content = UNMutableNotificationContent()
content.body = "\(userName) is calling..."
content.sound = UNNotificationSound(named: "sound_call.wav")
content.badge = 1
let request = UNNotificationRequest(identifier: "notification", content: content, trigger: nil)
UNUserNotificationCenter.current().add(request)
ありがとう!