не может инициализировать параметр типа UIRemote NotificationType с r-значением типа int - PullRequest
5 голосов
/ 14 декабря 2011

Когда я использую [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)]; для регистрации удаленного push-уведомления, возникает ошибка, говорящая cannot initialize a parameter of type 'UIRemoteNotificationType' with an rvalue of type 'int', кто-нибудь знает почему? спасибо.

Среда моего проекта: Xcode 4.2 + iOS 5.

1 Ответ

14 голосов
/ 14 декабря 2011

Вы должны явно привести его к UIRemoteNotificationType

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationType)(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
...