iOS. 极光推送 收不到自定义参数?能不能帮忙看看

xiaofan
2018-01-12 07:42 1k 0

iOS。在这个方法中收不到自定义的参数 但是安卓的可以收到

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
  // 取得 APNs 标准信息内容
  NSDictionary *aps = [userInfo valueForKey:@"aps"];
  NSString *content = [aps valueForKey:@"alert"]; //推送显示的内容
  NSInteger badge = [[aps valueForKey:@"badge"] integerValue]; //badge数量
  NSString *sound = [aps valueForKey:@"sound"]; //播放的声音

  // 取得Extras字段内容
  NSString *customizeField1 = [userInfo valueForKey:@"customizeExtras"]; //服务端中Extras字段,key是自己定义的
  NSLog(@"content =[%@], badge=[%d], sound=[%@], customize field  =[%@]",content,badge,sound,customizeField1);

  // iOS 10 以下 Required
  [JPUSHService handleRemoteNotification:userInfo];
}

1个回答

热门排序