我在
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的新手,所以请保持温和. 原文链接:https://www.f2er.com/swift/319391.html