设置UITabBarButton标签属性文本时的随机崩溃(Tab Title)

时间:2014-02-04 07:50:45

标签: ios ipad storyboard uitabbarcontroller uitabbar

我无法重现此崩溃,但是从生产版本中多次收到此类崩溃。在我的应用程序标签栏中,仅从故事板加载,标签栏始终隐藏。

它的主要原因是内存不足吗?任何猜测,如何解决或重现这类问题

Hardware Model:      iPad2,4
OS Version:      iPhone OS 7.0.4 (11B554a)
Report Version:  104

Exception Type:  SIGABRT
Exception Codes: #0 at 0x393f71fc
Crashed Thread:  0

Application Specific Information:
*** Terminating app due to uncaught exception 'NSRangeException', reason: 'NSMutableRLEArray replaceObjectsInRange:withObject:length:: Out of bounds'

Last Exception Backtrace:
0   CoreFoundation                      0x2e766f4b __exceptionPreprocess + 131
1   libobjc.A.dylib                     0x38e386af objc_exception_throw + 38
2   CoreFoundation                      0x2e766e8d +[NSException raise:format:] + 104
3   Foundation                          0x2f089aff -[NSMutableRLEArray replaceObjectsInRange:withObject:length:] + 122
4   Foundation                          0x2f088efb -[NSConcreteMutableAttributedString initWithString:attributes:] + 310
5   UIKit                               0x30ee8ed7 -[NSAttributedString(UILabelAdditions) _ui_synthesizeAttributedSubstringFromRange:usingDefaultAttributes:] + 86
6   UIKit                               0x30ee8c9f -[UILabel _synthesizedAttributedText] + 1010
7   UIKit                               0x30ee8307 -[UILabel _textRectForBounds:limitedToNumberOfLines:includingShadow:] + 222
8   UIKit                               0x30ee8213 -[UILabel textRectForBounds:limitedToNumberOfLines:] + 54
9   UIKit                               0x30ee80fb -[UILabel _intrinsicSizeWithinSize:] + 162
10  UIKit                               0x30ee8049 -[UILabel sizeThatFits:] + 32
11  UIKit                               0x30ee7f37 -[UIView(Geometry) sizeToFit] + 126
12  UIKit                               0x31002be1 -[UITabBarButton initWithImage:selectedImage:label:withInsets:] + 388
13  UIKit                               0x31001a1f -[UITabBarItem(Static) _createViewForTabBar:showingBadge:withTint:idiom:] + 1170
14  UIKit                               0x31001583 -[UITabBarItem(Static) _createViewForTabBar:showingBadge:idiom:] + 38
15  UIKit                               0x30ffd859 -[UITabBarItem(Static) _updateViewForIdiom:positionItems:] + 160
16  UIKit                               0x31004c43 -[UITabBar(Static) _configureItems:] + 406
17  UIKit                               0x310042db -[UITabBar(Static) _positionTabBarButtons:ignoringItem:] + 1234
18  UIKit                               0x3100133f -[UITabBar setItems:animated:] + 1358
19  UIKit                               0x31000d29 -[UITabBarController _rebuildTabBarItemsAnimated:] + 800
20  UIKit                               0x310051f9 -[UITabBarController _setSelectedViewController:] + 76
21  UIKit                               0x30eeb6e5 +[UIView(Animation) performWithoutAnimation:] + 72
22  UIKit                               0x31008bf7 -[UITabBarController _selectDefaultViewControllerIfNecessaryWithAppearanceTransitions:] + 218
23  UIKit                               0x31008077 -[UITabBarController viewWillAppear:] + 134
24  UIKit                               0x30ef40eb -[UIViewController _setViewAppearState:isAnimating:] + 346
25  CoreFoundation                      0x2e6aff65 __53-[__NSArrayI enumerateObjectsWithOptions:usingBlock:]_block_invoke + 52
26  CoreFoundation                      0x2e6a994d -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] + 220
27  UIKit                               0x30ef4265 -[UIViewController _setViewAppearState:isAnimating:] + 724
28  UIKit                               0x3106a4bf -[UINavigationController _startCustomTransition:] + 846
29  UIKit                               0x30f88273 -[UINavigationController _startDeferredTransitionIfNeeded:] + 418
30  UIKit                               0x30f8807d -[UINavigationController __viewWillLayoutSubviews] + 44
31  UIKit                               0x30f88015 -[UILayoutContainerView layoutSubviews] + 184
32  UIKit                               0x30ed9da3 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 346
33  QuartzCore                          0x30b60c6b -[CALayer layoutSublayers] + 142
34  QuartzCore                          0x30b5c47b CA::Layer::layout_if_needed(CA::Transaction*) + 350
35  QuartzCore                          0x30b5c30d CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
36  QuartzCore                          0x30b5bd1f CA::Context::commit_transaction(CA::Transaction*) + 230
37  QuartzCore                          0x30b5bb2f CA::Transaction::commit() + 314
38  QuartzCore                          0x30b5585d CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 56
39  CoreFoundation                      0x2e7321cd __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
40  CoreFoundation                      0x2e72fb71 __CFRunLoopDoObservers + 284
41  CoreFoundation                      0x2e72feb3 __CFRunLoopRun + 730
42  CoreFoundation                      0x2e69ac27 CFRunLoopRunSpecific + 522
43  CoreFoundation                      0x2e69aa0b CFRunLoopRunInMode + 106
44  GraphicsServices                    0x3336e283 GSEventRunModal + 138
45  UIKit                               0x30f3e049 UIApplicationMain + 1136
46  MyApp                               main (in MyApp) (main.m:16)
47  libdyld.dylib                       0x39340ab7 start + 2


Thread 0 Crashed:
0   libsystem_kernel.dylib              0x393f71fc __pthread_kill + 8
1   libsystem_c.dylib                   0x393a7ffd abort + 77
2   MyApp                               uncaught_exception_handler (in MyApp) + 27
3   CoreFoundation                      0x2e76724f __handleUncaughtException + 579
4   libobjc.A.dylib                     0x38e3890f _objc_terminate() + 175
5   libc++abi.dylib                     0x386ed1c7 std::__terminate(void (*)()) + 79
6   libc++abi.dylib                     0x386ecd2d __cxa_increment_exception_refcount + 1
7   libobjc.A.dylib                     0x38e387f7 objc_exception_rethrow + 43
8   CoreFoundation                      0x2e69ac9d CFRunLoopRunSpecific + 641
9   CoreFoundation                      0x2e69aa0b CFRunLoopRunInMode + 106
10  GraphicsServices                    0x3336e283 GSEventRunModal + 138
11  UIKit                               0x30f3e049 UIApplicationMain + 1136
12  MyApp                               main (in MyApp) (main.m:16)

1 个答案:

答案 0 :(得分:0)

从崩溃日志,第5行

    5   UIKit                               0x30ee8ed7 -[NSAttributedString(UILabelAdditions) _ui_synthesizeAttributedSubstringFromRange:usingDefaultAttributes:] + 86

似乎是基于

生成属性字符串
     - (NSAttributedString *)attributedSubstringFromRange:(NSRange)aRange

可能在该代码上设置一个断点,并检查你的字符串长度是否大于或等于该范围。