iOS中的DeepLink响应本机

时间:2019-10-25 14:43:47

标签: react-native

嗨,我如何使用iOS中的deepLinking重定向到youtube?我收到一条警告告诉我:Unable to open URL。这是代码:

class ChaineYT extends React.Component {

  state = {
    isLoading:false,
    isLinked: false
  }

  componentDidMount = () => {
      Linking.openURL('vnd.youtube://' + 'www.youtube.com/channel/UC1UpcbyFVTZTDrvdjNmSzSg');
      this.setState({isLoading:true, isLinked:true});
        if(this.state.isLoading && this.state.isLinking){
        this.props.navigation.navigate('Acceuil')
      }
  }

  render() {
    return (
      <View>

      </View>
    )
  }
}

export default ChaineYT

1 个答案:

答案 0 :(得分:1)

尝试使用

Linking.openURL('http://www.youtube.com/channel/UC1UpcbyFVTZTDrvdjNmSzSg');

更多信息

https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/YouTubeLinks/YouTubeLinks.html#//apple_ref/doc/uid/TP40007899-CH8-SW1