【发布时间】:2026-02-20 05:20:13
【问题描述】:
我正在尝试以这种方式注册我的本地通知应用程序:
UIApplication.sharedApplication().registerUserNotificationSettings(UIUserNotificationSettings(forTypes: UIUserNotificationType.Alert | UIUserNotificationType.Badge, categories: nil))
在 Xcode 7 和 Swift 2.0 中 - 我收到错误 Binary Operator "|" cannot be applied to two UIUserNotificationType operands。请帮帮我。
【问题讨论】:
-
带“()”的环绕声对我有用 UIApplication.sharedApplication().registerUserNotificationSettings(UIUserNotificationSettings(forTypes: (UIUserNotificationType.Alert | UIUserNotificationType.Badge), categories: nil))
-
现在我有:
Could not find an overload '|' that accepts the supplied arguments -
我没有别的想法,抱歉。