开发者

iOS - UIRemoteNotificationTypeBadge & Push

开发者 https://www.devze.com 2023-01-05 11:06 出处:网络
If my application is started and only started. I implemented application:didReceiveRemoteNotification: to receive the payload.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消