You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native:Linking.canOpenURL在iOS返回true安卓返回false求助

iOS上Linking.canOpenURL对非URL字符串误返回true的问题

后端传入字符串"twist"(并非合法URL),我用以下React Native Linking代码处理:

console.log(url);     
let linkOpened = false;     
Linking.canOpenURL(url).then((canOpen) => {       
console.log("canOpen : ", canOpen);       
if (canOpen) {         
Linking.openURL(url);         
linkOpened = true;       
} else {         
console.log("i am calling");       
}     
});

实际"twist"无法被打开,安卓模拟器返回false(结果正确),但iOS返回true(结果错误)。

我已在info.plist中添加如下配置:

<key>LSApplicationQueriesSchemes</key>
    <array>
        <string>twist</string>
        <string>nothing</string>
    </array>

运行环境为XCODE 14、Node 16.13.0,尝试过GitHub、Stack Overflow及苹果开发者论坛的方案均无效,恳请协助解决。

内容的提问来源于stack exchange,提问作者Mohammad Ali

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.09 00:30:41