iOS 7 ANCS: Discovering the primary ANCS Service UUID

前端 未结 6 1758
青春惊慌失措
青春惊慌失措 2020-12-23 15:43

Under iOS7, is the primary ANCS Service meant to be constantly advertised, or does it need to be enabled in obfuscated settings / implemented using a custom CBPeripheralMana

6条回答
  •  悲&欢浪女
    2020-12-23 16:23

    Well the reason is because you are setting the UUID for the advertisement Data Dictionary as a String and not as a CBUUID, also I think that key takes an array of CBUUIDs.

    therefore this should make it work:

    NSDictionary *advertisementData = @{
                                            CBAdvertisementDataServiceUUIDsKey:@[[CBUUID UUIDWithString:@"7905F431-B5CE-4E99-A40F-4B1E122D00D0"]],
                                            CBAdvertisementDataLocalNameKey:@"ANCS",
                                            };
    

    EDIT: Oh yeah my bad! I forgot to mention that if you are trying to discover this ANCS service from another iOS Device you wont be able to see it, not under iOS 7. Somehow the OS is reserving that service to itself and wont show up on your didDiscoverServices callback even though you might be seeing it on your advertisement data. It will however, work if you have an external device, like a non-iOS device, or a pebble-like device. This is how you expose the ANCS functionality but the rest of the implementation is up to consumer of the service.

提交回复
热议问题