iOS - UIRemoteNotificationTypeBadge & Push
If my application is started and only started. I implemented application:didReceiveRemoteNotification: to receive the payload. If a message is sent to my iPhone, is this method called for every registration type, such as the following one?
[[UIApplication sharedApplication]
registerForRemoteNotificationTypes:**UIRemoteNotificationTypeNone**]; //1
[[UIApplication sharedApplication]
registerForRemoteNotificationTypes:**UIRemoteNotificationTypeBadge**]; //2
[[UIApplicatio开发者_如何学运维n sharedApplication]
registerForRemoteNotificationTypes:**UIRemoteNotificationTypeSound**]; //3
[[UIApplication sharedApplication]
registerForRemoteNotificationTypes:**UIRemoteNotificationTypeAlert**]; //4
I have a big doubt for solution 1...
The method only needs to be called once. The types argument is a bitmask of the types that you wish to register for:
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound];
The code above would register for Badge and Sound remote notifications.
精彩评论