1:development 证书安装的app,推送环境是sandbox。
adhoc , distribution 证书安装的app,推送环境是production。
手机安装的极光推送能收到推送消息。用adhoc证书打包的IPA文件安装到手机上,极光就推送到生产环境上去了,所以会出现0|0的情况。
2:app 在运行状态和后台background的时候,都可以从- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
里收到payload。
app被进程杀掉,在用户点击弹出的apns推送信息时,会跳转- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {}函数。
launchOptions 里面就有remote notification的payload。
获取方法是:
NSDictionary* pushNotificationKey = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (pushNotificationKey) {
//这里定义自己的处理方式
NSLog(@"\n\ndidFinishLaunchingWithOptions\n pushNotificationKey %@\n\n",pushNotificationKey);
NSArray *allkeys=[pushNotificationKey allKeys];
NSString *allkeysstring = @"-";
for (NSString *s in allkeys) {
allkeysstring = [allkeysstring stringByAppendingString:s];
}
//[[[UIAlertView alloc] initWithTitle:nil message:allkeysstring delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show];
[self performSelector:@selector(handleRemoteNotification:) withObject:pushNotificationKey afterDelay:3.0f];
// [self handleRemoteNotification:pushNotificationKey];
}
这里面的pushNotificationKey 就是收到的payload。
网友评论