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

来源:互联网 发布:mac隐藏windows分区 编辑:程序博客网 时间:2024/06/05 11:38
在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)

0 0
原创粉丝点击