APNs Apple Push Notification Services 推送消息
来源:互联网 发布:重庆编程学校 编辑:程序博客网 时间:2024/05/16 06:10
是否使用APNs?
首先,APNs不是绝对可靠;它可以取代SMS, 但是在某些情况下也可能代价高昂。
I would like to receive Push Notifications on my iPhone (instead of using expensive SMS gateway services).
一、配置流程
- CSR ,保存私钥,设置密码
- 在新建app IDs的时候就生成SSL certificate(貌似与一般的证书生成不同)
- 制作pem文件,方便Your Server使用。 以下三合一
- The CSR
- The private key as a p12 file (PushChatKey.p12)
- The SSL certificate, aps_developer_identity.cer
二、APNs交互流程
三、代码节选
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{self.window.rootViewController = self.viewController;[self.window makeKeyAndVisible]; // 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(@"My token is: %@", deviceToken);} - (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error{NSLog(@"Failed to get token, error: %@", error);}
如果收不到apn消息:
1.请检查网络是否正常;
2.应用程序目前是否在前台,如在前台请切换至后台。
参考:
http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12
http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html
http://blog.mobileroadie.com/2011/06/best-practices-on-push-notifications/
http://mobiforge.com/developing/story/programming-apple-push-notification-services
- APNs Apple Push Notification Services 推送消息
- Apple Push Notification Services (APNS)苹果推送通知服务
- iOS - APNs(Apple Push Notification Services)推送通知
- APNS(Apple Push Notification Service)远程推送原理解析
- 关于推送消息 (apple push notification)
- APNS - Apple Push Notification Service
- 苹果推送通知服务教程 Apple Push Notification Services Tutorial
- 申请Apple Push Notification Services(推送服务)全流程
- 苹果推送通知服务教程 Apple Push Notification Services Tutorial
- Programming Apple Push Notification Services
- Programming Apple Push Notification Services
- Programming Apple Push Notification Services
- Programming Apple Push Notification Services
- Programming Apple Push Notification Services
- Programming Apple Push Notification Services
- iPhone Apple Push Notification Service (APNS)
- Apple Push Notification Service(APNS)开发指引
- Apple Push Notification Service(APNS)开发指引
- setStyleSheet来设置图形界面的外观
- 离开windows 好长间了,说说linux 上一些开发体会
- Dalvik虚拟机探析
- neroAacEnc参数设置
- Andrioid学习--文件下载初步
- APNs Apple Push Notification Services 推送消息
- PPP相关协议
- 乱七八糟的一堆js html笔记
- 为ARM平台添加rzsz指令
- mysql技术内幕-innodb存储引擎读书笔记(上)
- j2me上的script-各种脚本引擎的介绍和在游戏中的应用(1)
- [译] Flex 4 皮肤功能介绍
- AVD的中文路径出现的问题和更改avd的默认路径
- Android 中自定义属性(attr.xml,TypedArray)的使用!