我想你有你需要的所有东西。
您已将aps_development.cer
其添加到您的 keyChain Access 中。会这样显示...

之后将此证书导出到 .p12 文件中


如果需要,请添加密码

而且mac会询问你的用户密码来验证

完成所有这些操作后,您将获得 SSL 证书的 .p12 文件。现在将此代码添加到您的 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 开发人员,您将在您身边完成,您将收到通知。
在服务器端这两个链接对于在服务器端实现 APN 非常有帮助。
链接 1
链接 2
是的,不要忘记你从苹果得到的令牌会像这样显示, <a3002e43 c1d2d80d 95b0a1a6 893b3f7c c410a489 747b933d 04551d68 688c6c65>
所以你必须删除空格和括号,当我第一次实现 APN 时我遇到了问题,你的字符串必须看起来像这样a3002e43c1d2d80d95b0a1a6893b3f7cc410a489747b933d04551d68688c6c65
。