gpt4 book ai didi

ios - 注册后更新 Parse deviceToken

转载 作者:行者123 更新时间:2023-11-28 09:28:12 25 4
gpt4 key购买 nike

目前我有很多空的 deviceToken 字段。我发现这是因为在创建安装对象之前添加组存在问题 - 它会阻止后续的创建工作。

我现在想做的是再次获取该 deviceToken 并在 Parse 中更新它,但问题是,didRegisterForRemoteNotificationsWithDeviceToken 在第一次运行后再也不会运行...

在初始调用 didRegisterForRemoteNotificationsWithDeviceToken 之后有什么方法可以获取设备 token ?

最佳答案

这对 iOS 8 有效:

if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
UIUserNotificationSettings* notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];
[[UIApplication sharedApplication] registerForRemoteNotifications];
} else {
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}

关于ios - 注册后更新 Parse deviceToken,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31405193/

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