在.NET服务器中添加APN需要哪些东西 [英] What things needed to add APN in .NET server

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

问题描述

因为我在 google 上搜索过,所以我不确定在 .NET 服务器中实现 APN 需要什么东西.在 PHP 服务器中,我们创建了 .PEM 文件,但我的 .NET 开发人员要求我提供 .P12 文件,所以我很困惑.

作为来自 链接 2

是的,别忘了你从苹果那里得到的令牌会像这样显示 <a3002e43 c1d2d80d 95b0a1a6 893b3f7c c410a489 747b933d 04551d68 688c6c65> 所以你有一个 b 和括号去掉 b 空格>当我第一次实现这个空间的 APN 时,你的字符串必须看起来像这样 a3002e43c1d2d80d95b0a1a6893b3f7cc410a489747b933d04551d68688c6c65.

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.

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

  • The CSR (of developer certificate)
  • The private key as a p12 file (myapp.p12) (of development certificate)
  • The SSL certificate, aps_development.cer

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

Or is tht i have to just give .p12 file of my distribution certificate and ssl certificate?

解决方案

I think you have all the things you need.

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

After that export this certificate in .p12 file

Add the password if you want

And than mac will ask your user password to verify

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

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.

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

LINK 1 LINK 2

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天全站免登陆