Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
IOS 11和swift 4中的本地通知?_Ios_Iphone_Swift3_Ios11_Swift4 - Fatal编程技术网

IOS 11和swift 4中的本地通知?

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

我的应用程序在ios 10上运行良好,但在ios 11上它不会推送本地通知。 我的代码有错误吗

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个通知