如何在IOS上接收推送通知?
我正在尝试将firebase的RESTAPI与react native一起使用。我正在尝试使用通知请求,但我的提取无法工作 我有这样一个错误: 可能未处理的承诺拒绝(id:10): 语法错误:JSON分析错误:意外的EOF 我还将console.log记录我得到的响应: {U bodyBlob:{U data:{U collector:{Object],“blobId:“1223679F-6B8F-4104-9085-060585EDF71E”,“name:“1.1”,“offset”:0,“size”:0,“type:“text/html”},{U-bodyInit:{U-data:{U-collector:[Object],“blobId:“1223679F-6B8F-4104-9085-060585EDF71E”,“name:“name:”1.1”,“offset:0”,“size:“type:”text/html:“false:”,“标题:“{”map:“{”alt svc:“:”h3-29=“:443;ma=2592000,h3-T051=“:443”;ma=2592000,h3-Q050=“:443;ma=2592000,h3-Q046=“:443”;ma=2592000,quic=“:443”;ma=2592000;v=“46,43”,“内容长度”:“0”,“内容类型”:“text/html”,“日期”:“周二,2021年4月14:20 GMT”,“HT2服务器”:”x-content-type-options:“nosniff”,“x-frame-options:“SAMEORIGIN”,“x-xss-protection:“0”},“ok”:false,“status”:404,“statusText”:未定义,“type:“default”,“url”:https://fcm.googleapis.com/v1/projects/myproject-b5ae1/messages:send%20HTTP/1.1“} 这是我的回执,我在app.js的componentdidmount上给他打电话如何在IOS上接收推送通知?,ios,react-native,push-notification,Ios,React Native,Push Notification,我正在尝试将firebase的RESTAPI与react native一起使用。我正在尝试使用通知请求,但我的提取无法工作 我有这样一个错误: 可能未处理的承诺拒绝(id:10): 语法错误:JSON分析错误:意外的EOF 我还将console.log记录我得到的响应: {U bodyBlob:{U data:{U collector:{Object],“blobId:“1223679F-6B8F-4104-9085-060585EDF71E”,“name:“1.1”,“offset”:0,“s
Notif = async () => {
const headers = new Headers({
'Content-type': 'application/json',
Authorization: 'Bearer ' + (await AsyncStorage.getItem('token')),
message:{
token:"ff_Zolz1s0mmgrovad27JG:APA91bHlV5bAXyNHI3aWGyjltdgmJP8mmGBlEC0mPBA72IIJGqoliH4gm1rCQp0szQ5JypKxNhcWcKb7JrOwUTZDmaCB02y4dS553WVDdsxbWuLeK7cqoMjTRjFtFfdMb8bVGxO65BTq",
notification:{
body:"This is an FCM notification message!",
title:"FCM Message"
}
}
});
const options = {
method: 'POST',
headers: headers,
};
fetch('https://fcm.googleapis.com/v1/projects/myproject-b5ae1/messages:send HTTP/1.1', options)
.then((response) => {
console.log(response);
return response.json();
})
.then(
(err) => {
console.log(err);
},
);
};