【问题标题】:RCTLinkingManager : Listening to application urls in iOSRCTLinkingManager : 在 iOS 中监听应用程序 url
【发布时间】:2016-08-16 12:08:05
【问题描述】:
【问题讨论】:
标签:
javascript
ios
xcode
reactjs
react-native
【解决方案1】:
我刚刚写了关于 iOS 中的通用链接和 Android 中的深度链接。
https://github.com/parkerdan/React-Native-Rails-Universal-Linking
我的猜测是你没有通过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);
}