iOS - 检查应用程序中的推送通知支持 [英] iOS - Check for push notification support in the app

查看:83
本文介绍了iOS - 检查应用程序中的推送通知支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在应用程序中添加了推送通知。
我的应用程序基于推送通知工作。
当应用程序第一次运行时,它会显示用户是否想要接收推送通知的警报。
是否可以强制接受推送通知?
或者,如果这不可能,我们可以检查是否为此应用设置了推送通知,并以警报终止应用程序?

I added Push notifications to my application. And my application works based on push notifications. When the app runs for the first time, it is showing alert whether user wants to receive push notifications or not. Is it possible to make it mandatory to accept push notifications? Or if this is not possible, can we check whether push notifications are set for this app or not and terminate the application with alert?

推荐答案

您只能检查用户是否已选择接收推送通知:

You can only check whether user have selected to receive push-notifications:

UIRemoteNotificationType status = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
if (status == UIRemoteNotificationTypeNone)
{
    NSLog(@"User doesn't want to receive push-notifications");
}

这篇关于iOS - 检查应用程序中的推送通知支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆