ios 原生推送配置
来源:互联网 发布:淘宝营销战略论文 编辑:程序博客网 时间:2024/05/07 21:12
点击打开链接
点击打开链接
http://eric-gao.iteye.com/blog/1567777
1、将aps_developer_identity.cer转换成aps_developer_identity.pem格式
2、将p12格式的私钥转换成pem
openssl pkcs12 -nocerts -out Push_Noenc.pem -inPush.p12
4、创建p12文件
这样我们就得到了在.net或java等后台应用程序中使用的证书文件:aps_developer_identity.p12
接下来就要测试一下啦,是不是很激动~
为了测试证书工作的状况,我们可以使用“telnet gateway.sandbox.push.apple.com 2195”来检测一下,如果显示
然后,我们使用我们生成的证书和私钥来设置一个安全的链接去链接苹果服务器
在终端输入如下命令:openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert PushChatCert.pem -key PushChatKey.pem
需要输入密码(abc123 我们刚才所设置的)。
然后他会返回一系列的数据,这里我就粘贴一部分啦:
CONNECTED(00000003)
depth=1 /C=US/O=Entrust, Inc./OU=www.entrust.net/rpa is incorporated by reference/OU=(c) 2009 Entrust, Inc./CN=Entrust Certification Authority - L1C
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
。。。。。(省略)
。。。。。(省略)
。。。。。(省略)
Start Time: 1416389389
Timeout : 300 (sec)
Verify return code: 0 (ok)
---
测试就到这里啦。。。
------代码----
#pragma mark - 接受deviceToken
-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
__block NSString *token1 = [NSString stringWithFormat:@"%@", deviceToken];
NSLog(@"My token is:%@", token1);
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
token1 = [token1 stringByReplacingOccurrencesOfString:@"<" withString:@""];
token1 = [token1 stringByReplacingOccurrencesOfString:@">" withString:@""];
[SANDBOXHELPER saveCoreInfoToSandBox:token1 withKey:kDeviceTokenInSandBox];
NSMutableDictionary * dic = [NSMutableDictionary dictionaryWithObject:token1 forKey:@"deviceToken"];
if(getUserId && ![[getUserId stringValue] isEqualToString:@""]){//如果userID不为空
[dic setObject:getUserId forKey:@"memberId"];
}
[[JSFAPI shareInstance] do_request:upload_device_token withData:dic withSuccessHandler:^(NSDictionary *json) {
PYLog(@"%@",json);
} fail:^(NSError *error) {
PYLog(@"%@",error);
}];
});
}
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings{
NSLog(@"My token is:");
}
- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
NSLog(@"Failed to get token, error: %@" , error);
}
#pragma mark - 接受到push
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
PYLog(@"%@",userInfo);
[UIApplication sharedApplication].applicationIconBadgeNumber++;
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:nil message:userInfo[@"aps"][@"alert"] delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"去看看", nil];
[alert show];
objc_setAssociatedObject(alert, &alertViewAndUserInfo, userInfo, OBJC_ASSOCIATION_RETAIN);
}
1 0
- ios 原生推送配置
- iOS原生APNS推送
- ios原生推送
- iOS---原生推送通知
- IOS原生代码实现推送
- iOS - Push - 原生推送开发
- iOS实现服务器原生推送
- ios原生php端推送信息
- iOS推送证书配置
- iOS 推送证书配置
- 如何配置iOS推送通知
- 如何配置iOS推送通知
- 如何配置iOS推送通知
- 如何配置iOS推送通知
- 如何配置iOS推送通知
- 如何配置iOS推送通知
- iOS 消息推送证书配置
- iOS推送证书配置问题
- 基于java网上商城源码设计
- StringBuffer与StringBuilder的区别
- 专题实验 EXP & IMP可以实现跨平台
- 拖拉自定义小模块_Activity背景透明效果_多次击事件处理
- Java设计模式之装饰模式
- ios 原生推送配置
- Android的Manifest配置文件介绍
- Memcached与Magent配置测试
- Android提取短信验证码并自动填写
- 运行时错误:‘-2147217906(800400)’:书签无效的解决办法
- 欢迎使用CSDN-markdown编辑器
- 1059. Prime Factors (25)
- java抽象类的作用!
- python文件选择:tkFileDialog 基础