iOS - 应用程序因未知错误而崩溃

时间:2015-03-27 11:23:40

标签: ios iphone uitableview

我正在处理表格视图并在表格行中添加一些标签。并绑定他们的价值观。

但即使在正确执行完整的tableview数据源代码之后,我的应用程序突然崩溃了。

它出现以下错误。

请帮我解决此问题

-[__NSCFNumber length]: unrecognized selector sent to instance 0xb000000000000023

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber length]: unrecognized selector sent to instance 0xb000000000000023'

*** First throw call stack:
(
0   CoreFoundation                      0x0000000105003495 __exceptionPreprocess + 165
1   libobjc.A.dylib                     0x0000000104d5799e objc_exception_throw + 43
2   CoreFoundation                      0x000000010509465d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3   CoreFoundation                      0x0000000104ff4d8d ___forwarding___ + 973
4   CoreFoundation                      0x0000000104ff4938 _CF_forwarding_prep_0 + 120
5   UIKit                               0x0000000103a817c5 -[UILabel _shadow] + 34
6   UIKit                               0x0000000103a829fd -[UILabel drawTextInRect:] + 81
7   UIKit                               0x0000000103a84ab2 -[UILabel drawRect:] + 100
8   UIKit                               0x00000001039604bd -[UIView(CALayerDelegate) drawLayer:inContext:] + 474
9   QuartzCore                          0x000000010537d368 -[CALayer drawInContext:] + 116
10  QuartzCore                          0x0000000105281843 CABackingStoreUpdate_ + 2641
11  QuartzCore                          0x000000010537d274 ___ZN2CA5Layer8display_Ev_block_invoke + 59
12  QuartzCore                          0x000000010537d113 _ZN2CA5Layer8display_Ev + 1461
13  QuartzCore                          0x0000000105372173 _ZN2CA5Layer17display_if_neededEPNS_11TransactionE + 319
14  QuartzCore                          0x00000001053721f5 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 35
15  QuartzCore                          0x00000001052e5fb8 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 252
16  QuartzCore                          0x00000001052e7030 _ZN2CA11Transaction6commitEv + 394
17  QuartzCore                          0x00000001052e769d _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 89
18  CoreFoundation                      0x0000000104fcedc7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
19  CoreFoundation                      0x0000000104fced37 __CFRunLoopDoObservers + 391
20  CoreFoundation                      0x0000000104fae522 __CFRunLoopRun + 946
21  CoreFoundation                      0x0000000104fadd83 CFRunLoopRunSpecific + 467
22  GraphicsServices                    0x00000001073a1f04 GSEventRunModal + 161
23  UIKit                               0x0000000103900e33 UIApplicationMain + 1010
24  CW4Members                          0x0000000102ed6023 main + 115
25  libdyld.dylib                       0x0000000105ed65c9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

1 个答案:

答案 0 :(得分:0)

你的一个价值是NSNumber类型&你将它分配给标签,标签将其作为NSString。你可以通过

分配它
cell.label.text =  [value stringValue];

cell.Label.text = [NSString stringWithFormat:@"%@",value];