【测试深度】Ios10含以下,Json结构中,body的value为“”时,操作系统无法展示Notification

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/cadi2011/article/details/84573638
{
	"open_ids": "6456064906536960",
	"data": {
		"title": "A friend wants to share mood with you. Check it out.",
		"content": "",
		"url": "",
		"uid": "5477168498518016",
		"channel": 1,
		"action": 203,
		"source": 1,
		"large_img_url": "",
		"description": "",
		"event_type": "8",
		"unread_count": 1
	},
	"apns_data": {
		"aps": {
			"alert": {
				"title": "A friend wants to share mood with you. Check it out.",
				"body": ""    //出现原因为body的value是个空字符串
			},
			"badge": 1,
			"sound": "default"
		},
		"u": {
			"t": 203,
			"url": "",
			"uid": "5477168498518016",
			"channel": 1,
			"source": 1,
			"action": 203,
			"event_type": "8"
		}
	},
	"gcm_type": "8"
}

0、被坑等级:五星

⭐️⭐️⭐️⭐️⭐️

1、测试过程&结果

本来测试中,N台手机,接收push正常,毕竟Ios11、Ios12上收发push都是正常的,机型你也兼容了好几个,结果,没想到兼容性出现问题

结果:一台iphone se ,ios 10.3.3的系统,launcher上有数字提示,震动也有,通知栏就是没有Notificaiton

2、兼容类型:操作系统

3、解决方案,两种方式

方案1:不要让body的值是空的“”,下面例子中,还加入了subtitle

{
  "aps" : {
    "alert" : {
      "title" : "iOS远程消息,我是主标题!-title",
      "subtitle" : "iOS远程消息,我是主标题!-Subtitle",
      "body" : "Dely,why am i so handsome -body"
    },
    "badge" : "2"
  }
}

方案2:alert的值不要json对象,直接用字符串即可

{
  "aps" : {
    "alert" : “方案2”,
    "badge" : "2"
  }
}


4、总结

兼容性测试的重要性,可见不容忽视,不然就是一个大坑,该现象极为严重。push验证记住一定要在所有大系统上都ok

猜你喜欢

转载自blog.csdn.net/cadi2011/article/details/84573638