While advertising is now fixed, Scan Options for the CentralManager now have a major impact on discovery performance in iOS10 vs iOS 9.
[__centralManager scanForPeripheralsWithServices:@[[CBUUID UUIDWithString:MY_SERVICE_UUID]]
options:@{ CBCentralManagerScanOptionAllowDuplicatesKey : @NO }];
In iOS 7,8,9 the above option would detect services on locked devices etc. in less than a second. On iOS 10.1.1 it can take anywhere from 20 - 40 seconds.
Switching to:
[__centralManager scanForPeripheralsWithServices:@[[CBUUID UUIDWithString:MY_SERVICE_UUID]]
options:@{ CBCentralManagerScanOptionAllowDuplicatesKey : @YES }];
results in almost instant discovery again in iOS 10. Is this bug? Or just extreme power saving measure? From the docs:
"A Boolean value that specifies whether the scan should run without duplicate filtering. The value for this key is an
NSNumber
object. If YES
, filtering is disabled and a discovery event is generated each time the central receives an advertising packet from the peripheral. Disabling this filtering can have an adverse effect on battery life and should be used only if necessary. If NO
, multiple discoveries of the same peripheral are coalesced into a single discovery event. If the key is not specified, the default value is NO
."It seems like a bug as on earlier versions the difference in discovery time between the 2 options was minimal and from my tests the scanning device detects the advertising device almost instantly with @YES set, there's just a large delay until the CentralManager's delegate is called using @NO.