iOS 我可以构建一个应用程序或服务来保持蓝牙发现设备吗

标签 ios bluetooth push-notification bluetooth-lowenergy

<分区>

如果发现新设备,则向用户推送通知。 如何开始以及任何资源/示例代码?

最佳答案

前面三个答案都不正确。 iOS5 介绍 Core Bluetooth framework .

但是,此框架仅适用于 BT 4.0 LE;尽管如此,蓝牙。

这里还有 PDF 引用:http://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/CoreBluetooth_Framework/CoreBluetooth_Framework.pdf

例子

您的类必须符合 CBCentralManagerDelegateCBPeripheralDelegate 协议(protocol)。

CBCentralManager * btCentral = [[CBCentralManager alloc] initWithDelegate:self queue:nil];

/* Create an array of services from a CBUUID to scan for */
[btCentral scanForPeripheralsWithServices:nil options:nil];

这基本上是为了让您开始扫描外围设备。您还需要实现 CBCentralManagerDelegate 方法和其他一些方法,我建议阅读文档:

- (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral

- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI

- (void)centralManager:(CBCentralManager *)central didRetrieveConnectedPeripherals:(NSArray *)peripherals

关于iOS 我可以构建一个应用程序或服务来保持蓝牙发现设备吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12310905/

上一篇:iphone - 使用 webview 播放 mp3-是否可以在屏幕锁定时继续播放?

下一篇:ios - Cocos2d : call selector in selected method of CCMenuItem

相关文章:

iphone - 如何将自定义数组保存/重新加载到 plist

iOS7 HTML5 视频海报不工作

java - 蓝牙条码扫描仪的解码输出

java - 蓝牙适配器服务仍为空

ios - NS无效参数异常 : "Unrecognized selector sent to instance"

ios - 如何在uiactionsheet中管理uipickerview

java - ListView仅在旋转手机时显示数据

c# - 来自 C# 的 APNS 通知

ios - 应用程序在后台时未立即调用 DidReceiveRemoteNotification

ios - 如何在应用程序图标中显示通知计数?