从苹果推送通知服务发送设备令牌到服务器

发布于 2024-09-29 23:32:47 字数 684 浏览 3 评论 0原文

我正在研究苹果推送通知服务。现在我已经按照苹果 APNS 指南中的建议实现了委托方法。但这也表明必须将从 APNS 接收到的设备令牌发送到提供商服务器。

我对这件事真的很困惑。

因为当我启动应用程序时,它询问我是否要注册远程通知,但后来它从未显示过类似的内容。当时我没有代码来处理这个设备令牌。但现在即使我删除并重新安装了整个应用程序,它也不会显示类似的内容。

任何帮助将不胜感激。 我的代码是这样的

- (void)viewDidLoad {
    [super viewDidLoad];
    //registring for remote notifications
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge |UIRemoteNotificationTypeSound)];
}


- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { 
    NSLog(@"Device token is %@", deviceToken)
}

I am working on apple push notification service. Now I have implemented the delegates methods as suggested in apple APNS guide. But this also says that one has to send device token received from APNS to provider server.

I am really confused about this thing.

Because when I launched application it asked me if I want to register for remote notifications but then later it never showed anything like that. At that time I had no code to handle this device token. But now it does not show anything like that even if I have deleted and reinstalled the whole application.

Any help would be greatly appreciated.
My code is this

- (void)viewDidLoad {
    [super viewDidLoad];
    //registring for remote notifications
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge |UIRemoteNotificationTypeSound)];
}


- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { 
    NSLog(@"Device token is %@", deviceToken)
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

自控 2024-10-06 23:32:47

第一次安装时,注册通知的消息仅显示一次。要更改通知设置,您可以进入通知设置。

The message to register for notifications is displayed just one time, at the first installation. To change notifications settings, you can go in notifications settings.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文