使用React Native Linking和Firebase生成动态链接 . 除非应用程序在后台打开,否则当您单击链接时“托盘”打开时,一切正常 . 如果应用程序已经打开,当有人点击链接时它什么都不做 .
我的监听器设置在componentDidMount中,如documentation所说,但它没有触发 .
componentDidMount() {
Linking.addEventListener('url', this._handleOpenURL);
},
事实上,我已经经历了,并通知componentWillMount(),componentDidMount(),componentWillUpdate(),componentWillUnmount(),componentWillReceiveNewProps(),和_handleOpenURL(),当我点击链接,并 “重新打开” 我什么也没得到来自后台的应用程序?我究竟做错了什么?
1 回答
想出来,我会留下问题以防其他人有同样的问题 .
结果我只需要将此代码块添加到我的AppDelegate.m文件中 .