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.
精彩评论