Swiftを久しぶりに再開してみて、Local Notificationを実装しようとして出た以下のエラー。
Swift 2.0 – Binary Operator “|” cannot be applied to two UIUserNotificationType operands
訂正前のLocal Notification
1 |
application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: UIUserNotificationType.Sound | UIUserNotificationType.Alert | UIUserNotificationType.Badge, categories: nil)) |
訂正後のLocal Notification
1 |
application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: [.Sound, .Alert, .Badge], categories: nil)) |
こんな感じで書き方が変わってるので注意。
参考: Swift 2.0 – Binary Operator “|” cannot be applied to two UIUserNotificationType operands