开发者

How to enable push notification types from settings bundle when registering for push notification?

I have created settings bundle and also three switches for alert, sound and badge. I am also getting 0 or 1 according to switch(On/Off). Now how do I enable only selected notification types when calling this method

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(here I want to set types 开发者_运维知识库from settings)];

how do I set types?


You can just pass one (or the OR of multiple) UIRemoteNotificationType, like

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

I recommend that you enable all the types here. This would create a new settings for the App under Push Notification settings in the Settings app, which is the standard place for user configuration of push notification.

I would argue against having your own configuration in your app settings bundle.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜