简体   繁体   English

注册推送通知时如何从设置包中启用推送通知类型?

[英]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). 我也越来越根据0或1至开关(开/关)。 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 你可以只通过一个(或多个的OR) UIRemoteNotificationType ,像

[[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. 这下设置应用程序,这对于推送通知用户配置标准位置推送通知设置创建为App一个新的设置。

I would argue against having your own configuration in your app settings bundle. 我认为针对具有您的应用程序设置捆绑自己的配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM