我是 swift 语言的新手。我正在使用 UILocalNotification 发出本地通知。在 Objective-C 中,我可以通过将 RepeatInterval 分配为 0 来使其不重复。
UILocalNotification* alarm = [[UILocalNotification alloc] init];
alarm.repeatInterval = 0;
但是当我在 Swift 中将 0 分配给 RepeatInterval 时,出现错误。
let alarm : UILocalNotification = UILocalNotification()
alarm.repeatInterval = 0
如果您有任何解决办法,请告诉我。
最佳答案
您可以将其设置为零,如下所示:
alarm.repeatInterval = NSCalendarUnit(rawValue: 0)
这样您就可以正确地转换值。
关于ios - 如何使 UILocalNotification 在 swift 中不重复?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37403146/