Publish iOS 10 upgrade scanForPeripheralsWithServices not detecting any device

Updated iPhone 6+ to version iOS 10. by calling scanForPeripheralsWithServices with a list of services Identifiers do not receive any callback centralManager: didDiscoverPeripheral: advertData: RSSI

So far on iOS 9, the same code works fine.

by calling scanForPeripheralsWithServices with nil (service identifiers) it works in the foreground, but in the background scanning does not work both in the case of service identifiers and without service identifiers.

+4
source share
3 answers

. , , , , - .

iOS 9 NSUUID CBUUID - iOS10.

[CBUUID UUIDWithNSUUID:anNSUUID] scanForPeripheralsWithServices.

+2

, CBCentralManagerScanOptionSolicitedServiceUUIDsKey. , , .

NSArray *uuids = @[[CBUUID UUIDWithString:@"7905F431-B5CE-4E99-A40F-4B1E122D00D0"]];
[self.cm scanForPeripheralsWithServices:@[]
                                options:@{CBCentralManagerScanOptionAllowDuplicatesKey:@(YES),
                                    CBCentralManagerScanOptionSolicitedServiceUUIDsKey:uuids}];

- Apple, ​​ .

0

iOS 10.1 .

[centralManager scanForPeripheralsWithServices:[NSArray arrayWithObjects:[CBUUID UUIDWithString:AUUID], nil] options:nil];

.

:
iPhone 6, iOS 10.1
iPad mini 2, iOS 10.0.2

Central device
iPhone 5S, iOS 9.3.5

and both peripherals in the background, the iPhone 5S detected only the iPad mini 2.

0
source

Source: https://habr.com/ru/post/1655181/


All Articles