Javascript RCTLinkingManager:在iOS中侦听应用程序URL
感谢这篇精彩的文章: 我能够使深度链接和应用程序的链接工作。每当用户点击任何以我的自定义url开头的url时,应用程序就会打开。但问题是,如果是在后台打开的,我可以访问URL(打开应用程序的URL),从中获取一些值url://username:123) 但如果应用程序关闭,用户点击链接,应用程序将被打开,但我无法再访问urlJavascript RCTLinkingManager:在iOS中侦听应用程序URL,javascript,ios,xcode,reactjs,react-native,Javascript,Ios,Xcode,Reactjs,React Native,感谢这篇精彩的文章: 我能够使深度链接和应用程序的链接工作。每当用户点击任何以我的自定义url开头的url时,应用程序就会打开。但问题是,如果是在后台打开的,我可以访问URL(打开应用程序的URL),从中获取一些值url://username:123) 但如果应用程序关闭,用户点击链接,应用程序将被打开,但我无法再访问url 有什么解决方案吗?我刚刚写了关于iOS中的通用链接和深度链接Android 我猜你不是通过Linking.getInitialURL()获取初始URL的,它处理应用程序关
有什么解决方案吗?我刚刚写了关于iOS中的通用链接和深度链接Android 我猜你不是通过
Linking.getInitialURL()
获取初始URL的,它处理应用程序关闭的情况
componentDidMount(){
// this handles the case where the app is closed and is launched via Universal Linking.
Linking.getInitialURL()
.then((url) => {
if (url) {
// Alert.alert('GET INIT URL','initial url ' + url)
this.resetStackToProperRoute(url)
}
})
.catch((e) => {})
// This listener handles the case where the app is woken up from the Universal or Deep Linking
Linking.addEventListener('url', this.appWokeUp);
}