在.NET服务器中添加APN需要做什么 [英] What things needed to add APN in .NET server

查看:117
本文介绍了在.NET服务器中添加APN需要做什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我在Google上搜索过,所以我不确定在.NET服务器中实现APN所需要的东西.在PHP服务器中,我们创建了.PEM文件,但是我的.NET开发人员要求我提供.P12文件,所以我感到困惑.

As i have serch on google i am not sure that what things needed to implement APN in .NET server. In PHP server we create .PEM file but my .NET developer ask me for .P12 file so i am confuse.

正如来自 raywenderlich 建议为PHP服务器生成哪些内容是.PEM文件,但对于.NET生成什么?

As this nice Tutorial from raywenderlich suggest what thing need to generate for PHP server which is .PEM file but what for .NET?

根据本教程的建议,我有

AS this tutorial suggest I have

  • (开发人员证书的)CSR
  • 作为开发证书的p12文件(myapp.p12)的私钥
  • SSL证书aps_development.cer

我想发送此应用程序以进行adHoc分发,所以我的p12文件是否来自分发证书?

And i want to send this app for adHoc distribution so Is my p12 file will be from distribution certificate?

还是我只需要给出.p12 file of my distribution certificatessl certificate?

推荐答案

我认为您拥有所需的所有东西.

I think you have all the things you need.

您已将aps_development.cer添加到keyChain Access中.这样会显示出来...

You have aps_development.cer add it in your keyChain Access. Which will display like this...

之后,将此证书导出为.p12文件

After that export this certificate in .p12 file

根据需要添加密码

然后Mac会要求您输入用户密码进行验证

And than mac will ask your user password to verify

完成所有这些操作后,您获得了SSL证书的.p12文件.现在,将此代码添加到您的AppDelegate

After you Do all this thing you got .p12 file of your SSL certificate. Now add this code to your AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Let the device know we want to receive push notifications
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
        (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];

    return YES;
}

- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
    NSLog(@"Dilip My token is: %@", deviceToken);
       //remember this token it will be used at server side
}

- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
    NSLog(@"Dilip Failed to get token, error: %@", error);
}

现在您首先有两件事是certificate.p12文件,然后Device Token将其提供给您的.net开发人员,在您身边完成后,您会收到通知.

Now you have two thing first is certificate.p12 file and Device Token give it to your .net developer and you are done at your side you will get notification.

在服务器端,这两个链接对于在服务器端实现APN确实很有帮助.

At server side This two link is really helpful to implement APN at server side.

链接1 链接2

是的,别忘了您从苹果获得的令牌将像这样显示<a3002e43 c1d2d80d 95b0a1a6 893b3f7c c410a489 747b933d 04551d68 688c6c65>,因此您必须删除空格和括号,使bcoz在我第一次实现该空间的APN bcoz时遇到问题,因为您的字符串必须看起来像这样a3002e43c1d2d80d95b0a1a6893b3f7cc410a489747b933d04551d68688c6c65.

And yes don't forget the token you get from apple will display like this <a3002e43 c1d2d80d 95b0a1a6 893b3f7c c410a489 747b933d 04551d68 688c6c65> so you have to remove space and bracket that bcoz i have a problem when i have implemented APN first time bcoz of this space your string must be look like this a3002e43c1d2d80d95b0a1a6893b3f7cc410a489747b933d04551d68688c6c65.

这篇关于在.NET服务器中添加APN需要做什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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