1

From Fabric we are seeing crashes in the following function:

- (void)updateBadgecountForData;
{
    if(self.navigationController.tabBarItem == nil)
        return; //trying to fix crash

    if(data == NULL)
        [self navigationController].tabBarItem.badgeValue = nil;
    else
    {
        int badgeCount = 0;
        for(NSArray *dataAr in data)
        {
            for(NSObject *melding in dataAr)
            {
                if([melding isKindOfClass:[NSString class]] == false)
                    badgeCount++;
            }
        }

        if(badgeCount > 0)
            [self.navigationController tabBarItem].badgeValue = [NSString stringWithFormat:@"%i", badgeCount];
        else
            [self.navigationController tabBarItem].badgeValue = nil;
    }
}

The crash (which happens on the main thread) is on this line:

[self.navigationController tabBarItem].badgeValue = [NSString stringWithFormat:@"%i", badgeCount];

Crash:

Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000090

But I don't understand what is causing it. First I thought the tabBarItem could be nil so I added the check but no luck.

Help needed :)

Sjoerd Perfors
  • 2,317
  • 22
  • 37

0 Answers0