IOS 11和swift 4中的本地通知?
我的应用程序在ios 10上运行良好,但在ios 11上它不会推送本地通知。 我的代码有错误吗IOS 11和swift 4中的本地通知?,ios,iphone,swift3,ios11,swift4,Ios,Iphone,Swift3,Ios11,Swift4,我的应用程序在ios 10上运行良好,但在ios 11上它不会推送本地通知。 我的代码有错误吗 let notificationContent = UNMutableNotificationContent() let sound = self.defaults.string(forKey: "azan")! // Configure Notification Content notificationContent.title = "کاتەکانی بانگ" notificationConte
let notificationContent = UNMutableNotificationContent()
let sound = self.defaults.string(forKey: "azan")!
// Configure Notification Content
notificationContent.title = "کاتەکانی بانگ"
notificationContent.sound = UNNotificationSound(named: sound)
//notificationContent.subtitle = self.notificationstring
notificationContent.body = self.notificationstring
// Add Trigger
if(TimeInterval(time) > 0)
{
let notificationTrigger = UNTimeIntervalNotificationTrigger(timeInterval: TimeInterval(time), repeats: false)
// Create Notification Request
let notificationRequest = UNNotificationRequest(identifier: identifier, content: notificationContent, trigger: notificationTrigger)
// Add Request to User Notification Center
UNUserNotificationCenter.current().add(notificationRequest) { (error) in
if let error = error {
print("Unable to Add Notification Request (\(error), \(error.localizedDescription))")
}
}
}
你能告诉我你犯了什么错误吗?@crashlog他说没有错误!可以确定的是,你能给它一个唯一的标识符吗?要了解更多信息,请参阅它对我有用,在ios 11中,如果超过忽略所有通知,应用程序只能在队列上保存60个通知