Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot initialize a parameter of type UIRemote NotificationType with an rvalue of type int

When I use [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)]; to register remote push notificatioin, an error occurs saying cannot initialize a parameter of type 'UIRemoteNotificationType' with an rvalue of type 'int', does anybody know why? thank you.

My project's environment: Xcode 4.2 + iOS 5.

like image 446
Smeegol Avatar asked Dec 14 '11 09:12

Smeegol


1 Answers

You should cast it explicitly to UIRemoteNotificationType

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationType)(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
like image 130
jbat100 Avatar answered Oct 17 '22 00:10

jbat100