Trouble registering for multiple Push Notification types

I'm working on an application that is written in Objective-C++ and was running into some trouble when attempting to register for multiple types of push notifications. Every time I built the application I would receive the below exception if I attempted to register for more than one push notification type:

invalid conversion from 'int' to 'UIRemoteNotificationType'

It turns out this is because implicit conversion from int to an enum is disallowed in object C++. in order to overcome you need to change:

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


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

The difference being the cast to (UIRemoteNotificationType) in the second snippet of code

Interesting to note that the registerForRemoteNotificationTypes uses a bit mask to specify which types of notification you register for.