2015-11-09 13:22:39.220 TTS[33469:500649] cell0 create 2015-11-09 13:22:39.221 TTS[33469:500649] *** Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.29.5/UITableView.m:7943 2015-11-09 13:22:39.228 TTS[33469:500649] [ Uncaught Exception ] Name: NSInternalInconsistencyException, Reason: UITableView (<UITableView: 0x7f84ba818600; frame = (0 20; 414 672); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x7f84b955a7b0>; layer = <CALayer: 0x7f84b9555820>; contentOffset: {0, 0}; contentSize: {414, 80}>) failed to obtain a cell from its dataSource (<HomeViewController: 0x7f84b96b6a70>) [ Fe Symbols Start ] 0 CoreFoundation 0x00000001104e1f45 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x00000001145bddeb objc_exception_throw + 48 2 CoreFoundation 0x00000001104e1daa +[NSException raise:format:arguments:] + 106 3 Foundation 0x00000001142095ee -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198 4 UIKit 0x0000000112d8e960 -[UITableView _configureCellForDisplay:forIndexPath:] + 225 5 UIKit 0x0000000112d99e58 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 828 6 UIKit 0x0000000112d99f3f -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74 7 UIKit 0x0000000112d6f307 -[UITableView _updateVisibleCellsNow:isRecursive:] + 3187 8 UIKit 0x0000000112da2d1c -[UITableView _performWithCachedTraitCollection:] + 92 9 UIKit 0x0000000112d8a884 -[UITableView layoutSubviews] + 223 10 UIKit 0x0000000112cf8e40 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 710 11 QuartzCore 0x00000001123f559a -[CALayer layoutSublayers] + 146 12 QuartzCore 0x00000001123e9e70 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366 13 QuartzCore 0x00000001123e9cee _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 14 QuartzCore 0x00000001123de475 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277 15 QuartzCore 0x000000011240bc0a _ZN2CA11Transaction6commitEv + 486 16 QuartzCore 0x000000011240c37c _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92 17 CoreFoundation 0x000000011040d947 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23 18 CoreFoundation 0x000000011040d8b7 __CFRunLoopDoObservers + 391 19 CoreFoundation 0x000000011040350b __CFRunLoopRun + 1147 20 CoreFoundation 0x0000000110402e08 CFRunLoopRunSpecific + 488 21 GraphicsServices 0x00000001163a7ad2 GSEventRunModal + 161 22 UIKit 0x0000000112c4430d UIApplicationMain + 171 23 TTS 0x000000010f9f8f5f main + 111 24 libdyld.dylib 0x00000001150e392d start + 1 25 ??? 0x0000000000000001 0x0 + 1 [ Fe Symbols End ]
tableview加载时,在cellForRowAtIndexPath里会报错,这是因为里面确实返回了nil的cell,一定要相信程序给你的反馈
self.dataArray = [NSMutableArray arrayWithArray:award_array]; [self.dataArray insertObject:[NSNull null] atIndex:1]; if (self.recommendAppDic) [self.dataArray insertObject:self.recommendAppDic atIndex:0];
self.dataArray = [NSMutableArray arrayWithArray:award_array]; if (self.recommendAppDic) [self.dataArray insertObject:self.recommendAppDic atIndex:0]; [self.dataArray insertObject:[NSNull null] atIndex:0];
看看上面两块代码有什么区别.
看看上面