如何取消日程通知
How to cancel schedule notification
我在我的项目中使用 react-native-firebase: 5.5.6 和 react-native:0.59.10。我已经创建了一些日程通知。当我尝试取消其中一些时,那是行不通的。
cancelNotification = async (Id) => {
try{
await firebase.notifications().cancelNotification(Id);
}
catch(e){
console.error(e);
}
}
不知道问题出在哪里
函数"firebase.notifications().cancelNotification(id)" return一个Promise,
你将它与 await 一起使用吗?像这样:
async YourFunction(){
try{
const cancel = await firebase.notifications().cancelNotification(id);
console.log(cancel)
}
catch(e){
console.error(e)
}
}
您现在可以在您的日志中看到发生了什么,
希望对你有帮助
我在我的项目中使用 react-native-firebase: 5.5.6 和 react-native:0.59.10。我已经创建了一些日程通知。当我尝试取消其中一些时,那是行不通的。
cancelNotification = async (Id) => {
try{
await firebase.notifications().cancelNotification(Id);
}
catch(e){
console.error(e);
}
}
不知道问题出在哪里
函数"firebase.notifications().cancelNotification(id)" return一个Promise, 你将它与 await 一起使用吗?像这样:
async YourFunction(){
try{
const cancel = await firebase.notifications().cancelNotification(id);
console.log(cancel)
}
catch(e){
console.error(e)
}
}
您现在可以在您的日志中看到发生了什么, 希望对你有帮助