反应本机:链接API不发现Uber应用程序

出于某种原因,即使“openURL”方法打开它,React Native Linking API的“canOpenURL”方法也无法检测到我设备上的Uber应用程序。

有什么我失踪下面?

constructor(props) { super(props); this.state = { uberURL: 'uber://?client_id=eJCfG86Rz&action=setPickup', isUberInstalled: false }; } componentWillMount() { Linking.canOpenURL(this.state.uberURL).then(isUberInstalled => { this.setState({ isUberInstalled: isUberInstalled }); }); } 

this.state.isUberInstalled总是为false

您必须将您使用的scheme添加到您的应用的Info.plist LSApplicationQueriesSchemes

从canOpenURL :文档:

如果您的应用在iOS 9.0或之后进行了链接,则必须声明要传递给此方法的URLscheme。 通过在Xcode项目的Info.plist文件中使用LSApplicationQueriesSchemes数组来执行此操作。 对于您希望应用程序使用此方法的每个URLscheme,请将其作为string添加到此数组中。

如果您的(iOS 9.0或更高版本)应用程序使用您尚未声明的scheme调用此方法,则该方法返回NO,无论该scheme的适当应用程序是否安装在设备上。