【发布时间】:2015-02-17 12:25:01
【问题描述】:
我有一个标签栏,我试图通过将其设置为nil 来删除项目的徽章值。但是,有时,我会收到 EXC_BAD_ACCESS 错误。异常后主线程挂起,我poing:
(lldb) po [[self.tabBar items] objectAtIndex:2]
<UITabBarItem: 0x17015e980> //no problem with the class itself
(lldb) po [[[self.tabBar items] objectAtIndex:2] setBadgeValue:0]
nil
(lldb) po [[[self.tabBar items] objectAtIndex:2] setBadgeValue:1]
error: Execution was interrupted, reason: EXC_BAD_ACCESS (code=1, address=0x1).
The process has been returned to the state before expression evaluation.
(lldb) po [[[self.tabBar items] objectAtIndex:2] setBadgeValue:0]
nil
这似乎是随机发生的,至少我还没有找到特定的模式。但是,这没有任何意义。这是一个错误吗?
更新:糟糕,我尝试在上面的调试器中设置数字而不是字符串,在上面抛出异常是正常的,但原来的问题仍然存在。
【问题讨论】:
-
nil是badgeValue根据文档的默认值。所以原因一定是在别的地方……你说你传递了一个有效的字符串?
标签: ios objective-c uitabbarcontroller uitabbar uitabbaritem