繁体   English   中英

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

[英]send device token to server from apple push notification service

我正在研究苹果推送通知服务。 现在我已经按照苹果 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)
}

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM