c++ - iOS 上的 Qt 蓝牙

标签 c++ ios qt bluetooth

我试图为我的查询寻找答案。这似乎微不足道,但我还找不到答案。

我正在尝试在 iOS 上使用 Qt Bluetooth 运行程序。我能够在 MacOS 上成功使用它。

但即使是最基本的代码功能,如:

QBluetoothLocalDevice localDevice;
QString localDeviceName;

// Check if Bluetooth is available on this device
 if (localDevice.isValid()) {

// Turn Bluetooth on
localDevice.powerOn();

// Read local device name
localDeviceName = localDevice.name();

// Make it visible to others
localDevice.setHostMode(QBluetoothLocalDevice::HostDiscoverable);

// Get connected devices
QList<QBluetoothAddress> remotes;
remotes = localDevice.connectedDevices();
ui->textBrowser->setText(localDevice.name() + "\n" + localDevice.address().toString());

}

给我一​​个空 vector 作为地址。

在 iOS 中运行它是否需要一些特定的设置。我需要在 info.plist 文件上添加某些标志吗?请提出建议。

有关信息,我正在使用 Qt 5.7 和 xcode 8,在 macOS Sierra macbook 上编程并为 iOS10 构建它。

最佳答案

正如 Paulw11 所指出的,事实上,在 iOS 设备上只能使用低功耗蓝牙版本。

虽然 Qt 文档中没有具体提及,但我建议您尝试将 iOS 设备编程为与外围设备通信的 BLE 中央设备。

非常感谢 Paulw11 提供的信息。

关于c++ - iOS 上的 Qt 蓝牙,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40258183/

相关文章:

c++ - WinAPI SetSystemCursor 和 LoadCursorFrom - 如何设置默认光标?

C++ 在作为函数传递后从父级转换为子级?

ios - Apple Push Notification 服务服务器证书更新

iphone - 如何一一合并视频文件

c++ - QT-FTP上传错误

qt - 基类 'QAbstractListModel' 具有私有(private)复制构造函数

c++ - 将节点插入二叉树时要遵守什么规则?

c++ - C++ 中的友元方法 "not declared in this scope"

iphone - 当应用程序进入后台或手机被锁定时如何获取位置?

c++ - 如何以UI形式打开QML?