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

如何从React Native iOS应用中调用Bluefy浏览器?

在React Native iOS中调用Bluefy浏览器的URL Scheme

Bluefy对应的自定义URL Scheme是bluefy://。

你可以通过React Native的Linking组件结合该Scheme启动Bluefy并打开指定网页,示例代码如下:

import { Linking } from 'react-native';

const openUrlInBluefy = async (targetUrl) => {
  // 构造Bluefy可识别的URL格式
  const bluefyDeepLink = `bluefy://${targetUrl.replace(/^https?:\/\//, '')}`;
  const isSupported = await Linking.canOpenURL(bluefyDeepLink);

  if (isSupported) {
    await Linking.openURL(bluefyDeepLink);
  } else {
    console.log('设备未安装Bluefy浏览器');
  }
};

// 调用示例:打开目标蓝牙通信网页
openUrlInBluefy('https://your-bluetooth-webpage.com');

另外需要在iOS项目的Info.plist中添加Bluefy的Scheme到LSApplicationQueriesSchemes数组,否则canOpenURL会返回false:

<key>LSApplicationQueriesSchemes</key>
<array>
  <string>bluefy</string>
</array>

内容的提问来源于stack exchange,提问作者34n

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.12 06:24:49