简体   繁体   English

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

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

I am working on apple push notification service.我正在研究苹果推送通知服务。 Now I have implemented the delegates methods as suggested in apple APNS guide.现在我已经按照苹果 APNS 指南中的建议实现了委托方法。 But this also says that one has to send device token received from APNS to provider server.但这也说明必须将从 APNS 收到的设备令牌发送到提供者服务器。

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)
}

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.要更改通知设置,您可以进入通知设置。

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

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