尽管我指定了两个服务 UUID 和服务,IOS 只宣传一项服务,但我没有收到任何错误,并且添加服务错误函数被调用了两次,两次都没有错误,这是我的代码
for UUIDs in advertisingUUIDs
{
self.mainServicesArray.append(CBMutableService(type: UUIDs, primary: true))
}
for services in mainServicesArray
{
self.peripheralManager.addService(services)
}
self.peripheralManager.startAdvertising([CBAdvertisementDataServiceUUIDsKey: [mainServicesArray[0].UUID,mainServicesArray[1].UUID]])
其余代码运行良好,在我放在那里的示例中,它将宣传两个服务中的第一个,顺序无关紧要,第一个总是宣传第二个不,所以 UUID 是有效的服务它不会同时宣传它们,我确信它很简单,但我被卡住了。
谢谢