SomeWhereInEarth
SomeWhereInEarth

Reputation: 23

get eaaccessory macaddress in swift

i have a bt 2.0 device with certified.

i can send/recv data with this bt device with eaaccessory input/output stream.

but i went to get the device's mac address

there is a ios9 eaaccessory header

https://github.com/JaviSoto/iOS9-Runtime-Headers/blob/master/Frameworks/ExternalAccessory.framework/EAAccessory.h

how can i call this method ??

this app do not need submit to apple store.

Upvotes: 2

Views: 1134

Answers (2)

didge
didge

Reputation: 315

Calling accessory.valueForKey("macAddress") may work, but you might also find that some manufacturers encode the MAC address in the accessory.serialNumber field.

For example, Epson Bluetooth printers' serial numbers are just their MAC addresses without the : separators.

Upvotes: 0

Alessandro Ornano
Alessandro Ornano

Reputation: 35392

Try to get value with:

let mac = myAccessory.valueForKey("macAddress")
print("mac address is: \(mac)")

Upvotes: 3

Related Questions