一、APNS提供了两项基本的服务:
1. 消息推送
- 测试接口:gateway.sandbox.push.apple.com:219
- 产品接口:gateway.push.apple.com:2195
2. 反馈服务
- 测试接口:sandbox:feedback.push.apple.com:2196
- 产品接口:feedback.sandbox.push.apple.com:2196
二、APNS推送调用函数:
- app未打开开启的情况下:app调用
didFinishLaunchingWithOptions
函数
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
if (launchOptions) {
NSDictionary* pushInfo = [launchOptions objectForKey:@"UIApplicationLaunchOptionsRemoteNotificationKey"];
NSString *pushInfo = [[NSString stringWithFormat:@"%@",[pushInfo objectForKey:@"aps"]];
}
}
- app在后台运行时(Background状态):app调用
didReceiveRemoteNotification
函数
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo