Firebase 反应本机链接。当应用程序在托盘中时,addEventListener()不会触发
使用React原生链接和Firebase生成动态链接。除非你点击链接时应用程序在后台或“托盘”中打开,否则一切正常。如果有人单击链接时应用程序已打开,则它不会执行任何操作 我的监听器设置在componentDidMount中,就像上面所说的那样,但它没有启动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
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];
}