let view = UIView(frame: CGRect(x: 0, y: 0, 320, height: 568)) addSubview(view)
view.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight
会报以下错误:
Binary operator '|' cannot be applied to two UIViewAutoresizing operands
更改为:
view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
即可解决
但是在极光推送中遇到同样问题后,这样并不行
原OC代码:
[JPUSHService registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge |
UIUserNotificationTypeSound |
UIUserNotificationTypeAlert)
categories:nil];
转为swiftJPUSHService.registerForRemoteNotificationTypes(UIUserNotificationType.Badge.rawValue | UIUserNotificationType.Sound.rawValue | UIUserNotificationType.Alert.rawValue, categories: nil)
就是swift 和 OC 在枚举上的区别导致的