Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.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
Firebase 反应本机链接。当应用程序在托盘中时,addEventListener()不会触发_Firebase_React Native_Deep Linking_React Native Ios_React Native Linking - Fatal编程技术网

Firebase 反应本机链接。当应用程序在托盘中时,addEventListener()不会触发

Firebase 反应本机链接。当应用程序在托盘中时,addEventListener()不会触发,firebase,react-native,deep-linking,react-native-ios,react-native-linking,Firebase,React Native,Deep Linking,React Native Ios,React Native Linking,使用React原生链接和Firebase生成动态链接。除非你点击链接时应用程序在后台或“托盘”中打开,否则一切正常。如果有人单击链接时应用程序已打开,则它不会执行任何操作 我的监听器设置在componentDidMount中,就像上面所说的那样,但它没有启动 componentDidMount() { Linking.addEventListener('url', this._handleOpenURL); }, 事实上,我已经查看并警告过componentWillMount()、comp

使用React原生链接和Firebase生成动态链接。除非你点击链接时应用程序在后台或“托盘”中打开,否则一切正常。如果有人单击链接时应用程序已打开,则它不会执行任何操作

我的监听器设置在componentDidMount中,就像上面所说的那样,但它没有启动

componentDidMount() {
  Linking.addEventListener('url', this._handleOpenURL);
},

事实上,我已经查看并警告过componentWillMount()、componentDidMount()、componentWillUpdate()、componentWillUnmount()、componentWillReceiveNewProps()和_handleAppenurl(),当我单击链接并从后台“重新打开”应用程序时,我什么也没有得到?我做错了什么?

弄明白了,我会留下这个问题,以防其他人也有同样的问题

事实证明,我只需要将此代码块添加到AppDelegate.m文件中

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity
 restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler
{
  return [RCTLinkingManager application:application
                   continueUserActivity:userActivity
                     restorationHandler:restorationHandler];
} 

我想好了,我会留下这个问题,以防其他人也有同样的问题

事实证明,我只需要将此代码块添加到AppDelegate.m文件中

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity
 restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler
{
  return [RCTLinkingManager application:application
                   continueUserActivity:userActivity
                     restorationHandler:restorationHandler];
}