使用 React-native-ble-plx 配置 React-native

Posted

技术标签:

【中文标题】使用 React-native-ble-plx 配置 React-native【英文标题】:Configuring React-native with React-native-ble-plx 【发布时间】:2018-09-03 23:44:55 【问题描述】:

所以我遵循了这个指南:“https://blog.expo.io/so-you-want-to-build-a-bluetooth-app-with-react-native-and-expo-6ea6a31a151d”

在第一步的“3--ios 设置”中,“pod install”我收到此错误我不知道为什么,我按照确切的指南进行操作。

Ibrahims-MacBook-Pro:MyCar ibrahim$ cd ./ios
Ibrahims-MacBook-Pro:ios ibrahim$ pod install
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Pre-downloading: `ExpoKit` from `http://github.com/expo/expo.git`, tag `ios/2.5.10`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `React` from `../node_modules/react-native`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Fetching podspec for `react-native-ble-plx` from `../node_modules/react-native-ble-plx`
Fetching podspec for `yoga` from `../node_modules/react-native/ReactCommon/yoga`
[!] Unable to find a specification for `react-native-ble-plx-swift` depended upon by `react-native-ble-plx`
Ibrahims-MacBook-Pro:ios ibrahim$ 

这是错误

"[!] Unable to find a specification for `react-native-ble-plx-swift` depended upon by `react-native-ble-plx`"

【问题讨论】:

【参考方案1】:

打开位于 ./ios 文件夹内的 Podfile 并添加这一行

pod 'react-native-ble-plx-swift', :path => '../node_modules/react-native-ble-plx'

保存

运行pod install

【讨论】:

以上是关于使用 React-native-ble-plx 配置 React-native的主要内容,如果未能解决你的问题,请参考以下文章

低功耗蓝牙是不是支持网络?

React Native 中的蓝牙打印

react-native 中蓝牙连接、下发数据、监听数据

搜索引擎中隐性关键词的使用不构成不正当竞争

为什么要使用抽屉式光纤配线箱?

图像配准之医学图像配准