当我使用[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
注册远程推送通知时,会发生错误cannot initialize a parameter of type 'UIRemoteNotificationType' with an rvalue of type 'int'
,有人知道为什么吗?谢谢。
我的项目环境:Xcode 4.2 + iOS 5.
答案 0 :(得分:14)
您应该明确地将其强制转换为UIRemoteNotificationType
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationType)(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];