从Fabric中我们看到崩溃在以下函数中:
- (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;
}
}
崩溃(发生在主线程上)就在这一行:
[self.navigationController tabBarItem].badgeValue = [NSString stringWithFormat:@"%i", badgeCount];
崩溃:
Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000090
但我不明白是什么导致了它。首先我认为tabBarItem可能是零,所以我添加了检查,但没有运气。
需要帮助:)