什么是实现苹果推送通知的步骤是什么? [英] What are the steps in implementing Apple Push Notification?

查看:128
本文介绍了什么是实现苹果推送通知的步骤是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来这个话题,在我的应用程序中实现苹果推送通知需要一些指导。我创建了我的appid并且也配置苹果推送通知的相同。我已经下载了供应配置文件,并安装在iPhone上的应用程序。我也写了苹果的文档提供了以下code

I am new to this topic and require some guidance in implementing Apple Push Notification in my application. I have created my appID and also configured Apple Push Notification for the same. I have downloaded the provisioning profile and installed the app on the iphone. I have also written the following code provided by Apple documentation

- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken
{
    const void *devTokenBytes = [devToken bytes];
    NSLog(@"devToken=%@",devTokenBytes);
    //self.registered = YES;
    //[self sendProviderDeviceToken:devTokenBytes]; // custom method
}

- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err
{
    NSLog(@"Error in registration. Error: %@", err);
}

我想知道我必须在服务器端写入。当我运行code它说,该设备未注册。我如何注册我的推送通知的应用程序。

I want to know what I have to write on the server side. When I run the code it says that the device is not registered. How can I register my application for the push notification.

谁能帮我这...

任何code会有很大的帮助...

Any code will be very helpful...

感谢名单提前...

推荐答案

您需要告诉你关于苹果返回的设备令牌服务器,当您注册从设备的通知,让服务器可以present相同令牌和应用程序ID时,它告诉苹果的服务器,有一个新的通知。你有没有这样做呢?我相信该设备令牌可以在每次报名时间而改变,所以你需要保持跟踪你的服务器上(每次告诉服务器)。

You need to tell your server about the device token returned by Apple when you register for notifications from the device, so that the server can present the same token and app id when it tells the apple server that there's a new notification. Have you done that? I believe the device token could change each time you register, so you'll need to keep track of that on your server (and tell the server each time).

您已经表明参与设备注册的回调,但你居然叫登记方法本身?

You've shown the callbacks involved in device registration, but have you actually called the registration method itself?

这篇关于什么是实现苹果推送通知的步骤是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆