Swift中推送通知设置:Binary operator '|' cannot be applied to two UIUserNotificationType operands 错误解决

前端之家收集整理的这篇文章主要介绍了Swift中推送通知设置:Binary operator '|' cannot be applied to two UIUserNotificationType operands 错误解决前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在swif2.0中,推送设置不能使用|,

如果这么:let setting = UIUserNotificationSettings(forTypes: .Alert|.Badge|.Sound, categories: nil )

提示错误 :Binary operator '|' cannot be applied to two UIUserNotificationType operands


解决办法:

let setting = UIUserNotificationSettings(forTypes: [.Alert,.Badge,.Sound], categories: nil)

原文链接:https://www.f2er.com/swift/325608.html

猜你在找的Swift相关文章