【发布时间】:2013-08-01 16:21:20
【问题描述】:
我正在制作一个应用程序,其中 iOS 设备必须同时是外围设备和中心设备。当它发现外围设备时,有时它的名称是型号(例如 iPhone),而不是实际名称(例如我的 iPhone)。在这种情况下,UUID 就在那里(当名称是实际名称时,通常是 (null))。我在startAdvertising: 中正确设置了名称,当发生这种情况时,advertisementData 中的相应键没有给出真实名称
如何确保真实姓名始终存在?
这就是我设置名称的方式:
[self.peripheralManager startAdvertising:@{ CBAdvertisementDataLocalNameKey : [[UIDevice currentDevice] name], CBAdvertisementDataServiceUUIDsKey : @[SERVICE_UUID] }];
【问题讨论】:
标签: ios objective-c core-bluetooth