Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/97.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 更改“设置”应用程序中应用程序的通知首选项(默认iPhone应用程序)_Ios_Apple Push Notifications_Nsnotificationcenter - Fatal编程技术网

Ios 更改“设置”应用程序中应用程序的通知首选项(默认iPhone应用程序)

Ios 更改“设置”应用程序中应用程序的通知首选项(默认iPhone应用程序),ios,apple-push-notifications,nsnotificationcenter,Ios,Apple Push Notifications,Nsnotificationcenter,我的应用已使用registerForRemoteNotificationTypes成功注册远程推送通知:这将导致在设备的“设置->通知中心”中为我的应用添加通知首选项。比方说,警报类型设置为UIRemoteNotificationTypeBadge 问题:如果用户在设置中将我的应用程序的通知首选项从UIRemoteNotificationTypeBadge更改为UIRemoteNotificationTypeNone,我的应用程序在运行时是否会得到此更改的指示?例如,应用程序使用[[NSNoti

我的应用已使用registerForRemoteNotificationTypes成功注册远程推送通知:这将导致在设备的“设置->通知中心”中为我的应用添加通知首选项。比方说,警报类型设置为UIRemoteNotificationTypeBadge

问题:如果用户在设置中将我的应用程序的通知首选项从UIRemoteNotificationTypeBadge更改为UIRemoteNotificationTypeNone,我的应用程序在运行时是否会得到此更改的指示?例如,应用程序使用[[NSNotificationCenter defaultCenter]addObserver……]将自身添加为观察者,以进行系统范围的设置更改


我无法从apple文档中获取上述场景的任何信息。

取决于信息的类型,例如,要知道用户是否禁用了通知或某种类型的通知,您可以使用:

UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];

if (types == UIRemoteNotificationTypeNone) {
    //User disabled notifications
}
类型包括:

UIRemoteNotificationTypeNone    = 0,
UIRemoteNotificationTypeBadge   = 1 << 0,
UIRemoteNotificationTypeSound   = 1 << 1,
UIRemoteNotificationTypeAlert   = 1 << 2,
UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3

我希望当用户在运行时动态更改设置中的通知首选项时,我的应用程序会收到通知。我知道你在回答中提到的检查,但不是我想要的。在运行时??当用户处于设置中时,他不在您的应用程序中。如果您在应用程序中的应用程序委托中进行检查,则每次用户在应用程序中再次输入时,应用程序将进入前台或应用程序IDBECOMEACTIVE,应用程序所做的第一件事就是检查。为什么你需要另一种方式?我认为当用户这样做时没有理由这样做,因为这是不可能的。但我再说一遍,真的没有理由!