我正在尝试发送推送通知,并且我需要通过httpBody发送APN有效负载。我找到了this,但是我不知道上下文。当我尝试直接将httpBody设置为它时,出现了很多错误。
request.httpBody = { //Cannot assign value of type '() -> ()' to type 'Data?'
"aps" : { //Consecutive statements on a line must be separated by ';'
"alert" : { //Consecutive statements on a line must be separated by ';'
"body" : inputedBody, //Consecutive statements on a line must be separated by ';'
"title" : inputedTitle
}, //Consecutive statements on a line must be separated by ';'
}, //Consecutive statements on a line must be separated by ';'
}
很抱歉,如果这是一个愚蠢的问题,我是新手,也无法在任何地方找到上下文。我发现的每个站点都只是告诉我要在有效负载中放入什么,而不是如何插入有效负载。
(对于上下文,这是一个向其他应用发送推送通知的应用)