【发布时间】:2014-08-10 20:22:30
【问题描述】:
我在 Xcode 6 操场上有以下代码:
import Cocoa
import IOBluetooth
class BlueDelegate : IOBluetoothDeviceInquiryDelegate {
func deviceInquiryComplete(sender: IOBluetoothDeviceInquiry, error: IOReturn, aborted: Bool) {
aborted
var devices = sender.foundDevices()
for device : AnyObject in devices {
if let thingy = device as? IOBluetoothDevice {
thingy.getAddress()
}
}
}
}
var inquiry = IOBluetoothDeviceInquiry(delegate: BlueDelegate())
inquiry.start()
我刚刚开始在 OSX 下使用蓝牙,目前我想要的只是范围内的设备列表。
它似乎根本没有调用我的委托方法。
我是 OSX 开发和 Swift 的新手,所以要温柔。 :)
【问题讨论】:
标签: macos bluetooth swift iobluetooth