iOSHeartRateMonitor
iOSHeartRateMonitor copied to clipboard
retrievePeripherals gives signal SIGABRT
I am trying to get sample code work with Polar H7 (Bluetooth Smart). HRM hangs on following line in iPad 3 with iOS 6 environment. Any glue why (CBPeripheral *)aPeripheral is nil?
// Retrieve already known devices [self.manager retrievePeripherals:[NSArray arrayWithObject:(id)aPeripheral.UUID]];
Thread 1: signal SIGABRT
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'
Printing description of aPeripheral: <CBConcretePeripheral: 0x1c5428d0 UUID = (null), Name = "(null)", IsConnected = NO> Printing description of advertisementData: { kCBAdvDataManufacturerData = <6b00031c 36>; kCBAdvDataServiceUUIDs = ( "Unknown (<180d>)" ); kCBAdvDataTxPowerLevel = 0; } Printing description of RSSI: -54
I did add following line, which prevents adding corrupted peripheral.
if (!aPeripheral.name) { return; }
Second time function is called Name is added to peripheral, but .UUID is still null.
<CBConcretePeripheral: 0x1d57d3f0 UUID = (null), Name = "Polar H7 000277", IsConnected = NO>
So, I must fetch by .name, not by .UUID.
[self.manager retrievePeripherals:[NSArray arrayWithObject:(id)aPeripheral.name]];
It seems that eventually it could not retrieve any peripherals. At least count is 0.
Retrieved peripheral: 0 - ( )
Is it mandatory to have UUID for peripheral?
I've noticed a few problems like this on iOS6.
Frequently the peripheral.name is nil the first time a peripheral is seen by an iOS6 device. This seems to be a bug, because after disconnecting and reconnecting, the name is known.
When iOS6 devices disconnect, often the attached service is not fully disconnected and remains in limbo until it times out. This also seems to be an iOS6 bug.
Also, the UUID for some services can be nil.
On Sun, Sep 30, 2012 at 4:08 AM, forceoflight [email protected]:
I did add following line, which prevents adding corrupted peripheral.
if (!aPeripheral.name) { return; }
Second time function is called Name is added to peripheral, but .UUID is still null.
So, I must fetch by .name, not by .UUID.
[self.manager retrievePeripherals:[NSArray arrayWithObject:(id)aPeripheral.name]];
It seems that eventually it could not retrieve any peripherals. At least count is 0.
Retrieved peripheral: 0 - ( )
Is it mandatory to have UUID for peripheral?
— Reply to this email directly or view it on GitHubhttps://github.com/timburks/iOSHeartRateMonitor/issues/1#issuecomment-9012690.
Is it possible to connect to it when UUID is nil? I tried calling directly connectPeripheral in didDiscoverPeripheral. The didConnectPeripheral gets called a couple of times. But I don't know what I did it doesn't work anymore, didConnectPeripheral no longer gets called.
does anyone have more info on this issue?