从苹果推送通知服务发送设备令牌到服务器
我正在研究苹果推送通知服务。现在我已经按照苹果 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
第一次安装时,注册通知的消息仅显示一次。要更改通知设置,您可以进入通知设置。
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.