gpt4 book ai didi

iphone - 如果推送已关闭,为什么 iPhone 仍会向我提供设备 token ?

转载 作者:行者123 更新时间:2023-12-03 20:52:27 26 4
gpt4 key购买 nike

第一次运行应用程序时,系统询问我是否允许推送通知,因此我选择"is"。现在,当我转到设置并关闭应用程序的所有通知时,我仍然从 - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken; 获取设备 token 。作为开发人员,我是否有责任跟踪我的应用程序是否已启用?或者这是一个错误?

最佳答案

设备 token 通常存储在服务器上的某个位置。如果用户突然决定需要推送通知并将其重新打开,则他们的设备 token 已生成并存储在您的服务器上。

如果未生成设备 token ,则用户必须确保应用程序已终止然后重新启动才能生成设备 token 。

您可以使用以下代码确定用户是否关闭了推送通知

UIRemoteNotificationType remoteNotificationType = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
if (remoteNotificationType == UIRemoteNotificationTypeNone) {
... Do not send push
}

关于iphone - 如果推送已关闭,为什么 iPhone 仍会向我提供设备 token ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10407138/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com