Cited by: http://www.jianshu.com/p/1d6a8fc8134f
iOS to get Bluetooth device MAC address There are two: first, the hardware engineer to open the service characteristics of the MAC information, we get from the channel, and the second is the hardware engineer in the scan device information placed in the MAC information, we get from the Rssi function
1. As you can see on other sites on the service of a board module, such as: "A180", which has acquired the characteristics of the Mac. Here we skip, because other places are very clear, the invocation of the Office also has. Requires hardware provisioning and adding service features.
2. Is obtained in the function with Rssi.
First let the hardware engineer write the MAC information on the Board module.
-(void) Centralmanager: (Cbcentralmanager *) Central diddiscoverperipheral: (cbperipheral *) Peripheral Advertisementdata: (nsdictionary *) advertisementdata Rssi: (NSNumber *) Rssi
- (void) Centralmanager: (Cbcentralmanager *) Central diddiscoverperipheral: (cbperipheral *) Peripheral Advertisementdata: ( Nsdictionary<nsstring *, id> *) advertisementdata RSSI: (NSNumber *) rssi{//Get MacNSLog (@"%@ ", peripheral); NSLog (@"%@ ", Peripheral.name); NSLog (@"%@ ", peripheral.identifier.UUIDString); NSData*data = [Advertisementdata objectforkey:@"Kcbadvdatamanufacturerdata"]; NSString*astr=[[NSString alloc] Initwithdata:data encoding:nsutf8stringencoding];//nsstring *mac = [Nsstringtool converttonsstringwithnsdata:data];ASTR = [AStr stringbyreplacingoccurrencesofstring:@" "Withstring:@""]; NSLog (@"astr:%@", ASTR); NSLog (@"advertisementdata:%@", Advertisementdata); //a perimeter may be found many times if(![_peripheralarr containsobject:peripheral]) {[_peripheralarr addobject:peripheral]; if([Self.Delegaterespondstoselector: @selector (blemanagerupdatedevicelist)]) {[Self.DelegateBlemanagerupdatedevicelist]; } }}
You can see there is a advertisementdata, this dictionary type is the broadcast packet, there will be some device properties, such as the name of the device, service Ah, etc., but are limited by Apple, so it is not your hardware engineers want to broadcast anything can.
This dictionary has a: only this key can be put into the information, so the hardware engineer to write the MAC address in this field, so you can find the device in the process of getting MAC address!
Key:kcbadvdatamanufacturerdata
IOS Bluetooth Get MAC Address