#UIUserNotificationTypeの"|"でエラーした
Swift1.2まではUIUserNotificationTypeのoption設定は"|"で区切ることによって複数設定していた。が、Swift2.0に更新したらerrorが発生しちゃった。
どうやらUIUserNotificationTypeの型がRawOptionSetType(Bit演算可能)からOptionSetType(Bit演算不可能)に変更されたのが原因らしい。
・Swift1.2 ver
AppDelegate.swift
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
application.registerUserNotificationSettings(
UIUserNotificationSettings(forTypes:
UIUserNotificationType.Sound
| UIUserNotificationType.Badge
| UIUserNotificationType.Alert
, categories: nil))
return true
}
error: Binary Operator "|" cannot be applied to two UIUserNotificationType operands
・Swift2.0 ver
AppDelegate.swift
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
application.registerUserNotificationSettings(
UIUserNotificationSettings(forTypes:
[UIUserNotificationType.Sound,
UIUserNotificationType.Badge,
UIUserNotificationType.Alert]
, categories: nil))
return true
}
これでO.K.
###参考URL
StackOverFlow: http://stackoverflow.com/questions/30761996/swift-2-0-binary-operator-cannot-be-applied-to-two-uiusernotificationtype
Toyship.org: http://www.toyship.org/archives/2208