Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 角度2+;FCM getToken()不返回任何内容_Angular_Push_Message - Fatal编程技术网

Angular 角度2+;FCM getToken()不返回任何内容

Angular 角度2+;FCM getToken()不返回任何内容,angular,push,message,Angular,Push,Message,我正在用Chrome写FCM 下面的代码工作正常 this.messaging.requestPermission() .then(() => { ... }) 但在获得许可后,当我想要获取令牌时,getToken()没有返回任何内容。它不调用.then()甚至.catch() 请帮帮我。这是我的错。我注销了服务人员的注册,然后重试。它正在工作。如果你注销服务人员,那么它为什么会工作,因为没有服务人员它就不会工作。请解释一下 this.messaging.getToken

我正在用Chrome写FCM

下面的代码工作正常

this.messaging.requestPermission()
        .then(() => { ... })
但在获得许可后,当我想要获取令牌时,getToken()没有返回任何内容。它不调用.then()甚至.catch()


请帮帮我。

这是我的错。我注销了服务人员的注册,然后重试。它正在工作。如果你注销服务人员,那么它为什么会工作,因为没有服务人员它就不会工作。请解释一下
this.messaging.getToken()
        .then( t => console.log(t) )
        .catch( e => console.error(e) );