I have developed an iOS iPad application which works with "ant + connectors (footpod and heartrate)
".
To interface with those two connectors I have used Wahoo api (WFConnector.framework
). It was working fine till I tested it on iPad retina device.
It crashes on iPad 3 retina for method
- (NSArray*)getSensorConnections:(WFSensorType_t)sensorType;
when I try to connect garmin footpod with my application.
It is working fine with iPad 2 (ios7 and ios8) , I am not getting why it is crashing on iPad 3 retina only. I think it might be because of 64 bit architecture in iPad 3. But what can be the relation of it with crash.
I have used following code to update sensor:
- (void)updateSensorStatusNew
{
@try {
@autoreleasepool {
// configure the status fields for the heartrate sensor.
NSArray* connections = [hardwareConnector getSensorConnections:WF_SENSORTYPE_HEARTRATE]; /////////**************************** I GET CRASH ON THIS LINE
ALog(@"here in %@",[self class]);
WFSensorConnection* sensor = ([connections count]>0) ? (WFSensorConnection*)[connections objectAtIndex:0] : nil;
if ( sensor )
{
//WFHeartrateData* hrData = [(WFHeartrateConnection*)sensor getHeartrateData];
BOOL hrConnected = (sensor != nil && sensor.isConnected) ? TRUE : FALSE;
//USHORT devId = sensor.deviceNumber;
if ( hrConnected) {
//lbl2.text = @"HR 7 Connected";
}
else {
// lbl2.text = @"HR 8 Not Connected";
}
}
else
{
//lbl2.text = @"HR 9 Not Connected";
}
// configure the status fields for the Bike Speed and Cadence sensor.
connections = [hardwareConnector getSensorConnections:WF_SENSORTYPE_FOOTPOD];
ALog(@"%@,%lu",connections,(unsigned long)connections.count);
ALog(@"here in %@",[self class]);
sensor = ([connections count]>0) ? (WFSensorConnection*)[connections objectAtIndex:0] : nil;
ALog(@"here in %@",[self class]);
if ( sensor )
{
//WFFootpodData* fpData = [(WFFootpodConnection*)sensor getFootpodData];
ALog(@"here in 308 %@",[self class]);
BOOL fpConnected = (sensor != nil && sensor.isConnected) ? TRUE : FALSE;
//USHORT devId = sensor.deviceNumber;
if ( fpConnected) {
// lbl3.text = @"FP 10 Connected";
}
else {
//lbl3.text = @"FP 11 Not Connected";
}
}
else
{
//lbl3.text = @"FP 12 Not Connected";
/*
fpConnectedLabel.text = @"No";
fpDeviceIdLabel.text = @"n/a";
fpSignalLabel.text = @"n/a";*/
}
}
ALog(@"here in 327 %@",[self class]);
}
@catch (NSException *exception) {
NSLog(@"Exception:%@",exception);
}
@finally {
//Display Alternative
}
}
And the crash log I am getting on that function is
Nov 14 11:26:52 VirtualRunner-V3[6642] <Warning>: App crashing with exception: *** -[__NSArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]
Nov 14 11:26:52 VirtualRunner-V3[6642] <Error>: *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
*** First throw call stack:
(0x2ffeaf83 0x3ab8dccf 0x2ff21a39 0x8448b 0x839cf 0x2ffad1a1 0x2ff214ef 0x3090ca3d 0x3091131b 0x27c3f 0x2d00d1 0x309d5b05 0x2ffb6167 0x2ffb5d7f 0x2ffb411b 0x2ff1eebf 0x2ff1eca3 0x34e45663 0x3286b14d 0x172e29 0x22108)
Nov 14 11:26:52 VirtualRunner-V3[6642] <Warning>: We received a signal: 6
I have also updated my WFConnector.framework
to the latest version.
How to solve this?
Thanks.