I am making an application in which the iOS device must be peripheral and central at the same time. When it discovers a peripheral device, sometimes its name is the model (for example, iPhone), and not the actual name (for example, My iPhone). In this case, the UUID is used instead (usually this is (null) when the name is the actual name). I set the name correctly in startAdvertising: and when that happens, the real name will not be provided with the corresponding key in advertisementData
How can I make sure that the real name always exists?
This is how I set the name:
[self.peripheralManager startAdvertising:@{ CBAdvertisementDataLocalNameKey : [[UIDevice currentDevice] name], CBAdvertisementDataServiceUUIDsKey : @[SERVICE_UUID] }];
source share