Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/112.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios [\uu NSArrayM objectAtIndex:]:索引2超出空数组的界限'_Ios_Objective C - Fatal编程技术网

Ios [\uu NSArrayM objectAtIndex:]:索引2超出空数组的界限'

Ios [\uu NSArrayM objectAtIndex:]:索引2超出空数组的界限',ios,objective-c,Ios,Objective C,我要撞车了。这是我撞车的原因。我不明白我在做什么 reason: '*** -[__NSArrayM objectAtIndex:]: index 2 beyond bounds for empty array' *** First throw call stack: ( 0 CoreFoundation 0x036131e4 __exceptionPreprocess + 180 1 libob

我要撞车了。这是我撞车的原因。我不明白我在做什么

 reason: '*** -[__NSArrayM objectAtIndex:]: index 2 beyond bounds for empty array'
    *** First throw call stack:
    (
        0   CoreFoundation                      0x036131e4 __exceptionPreprocess + 180
        1   libobjc.A.dylib                     0x02c1c8e5 objc_exception_throw + 44
        2   CoreFoundation                      0x035b43f6 -[__NSArrayM objectAtIndex:] + 246
        3   Stampd                              0x0007e928 -[VenueProfile tableView:cellForRowAtIndexPath:] + 472
        4   UIKit                               0x017c811f -[UITableView _createPreparedCellForGlobalRow:withIndexPath:] + 412
        5   UIKit                               0x017c81f3 -[UITableView _createPreparedCellForGlobalRow:] + 69
        6   UIKit                               0x017a9ece -[UITableView _updateVisibleCellsNow:] + 2428
        7   UIKit                               0x017be6a5 -[UITableView layoutSubviews] + 213
        8   UIKit                               0x0173e964 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
        9   libobjc.A.dylib                     0x02c2e82b -[NSObject performSelector:withObject:] + 70
        10  QuartzCore                          0x0055945a -[CALayer layoutSublayers] + 148
        11  QuartzCore                          0x0054d244 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
        12  QuartzCore                          0x0054d0b0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
        13  QuartzCore                          0x004b37fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
        14  QuartzCore                          0x004b4b85 _ZN2CA11Transaction6commitEv + 393
        15  QuartzCore                          0x00581cc6 _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 474
        16  QuartzCore                          0x00582147 _ZN2CA7Display16TimerDisplayLink8callbackEP16__CFRunLoopTimerPv + 123
        17  CoreFoundation                      0x035d1ac6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
        18  CoreFoundation                      0x035d14ad __CFRunLoopDoTimer + 1181
        19  CoreFoundation                      0x035b9538 __CFRunLoopRun + 1816
        20  CoreFoundation                      0x035b89d3 CFRunLoopRunSpecific + 467
        21  CoreFoundation                      0x035b87eb CFRunLoopRunInMode + 123
        22  GraphicsServices                    0x03bdb5ee GSEventRunModal + 192
        23  GraphicsServices                    0x03bdb42b GSEventRun + 104
        24  UIKit                               0x016cff9b UIApplicationMain + 1225
        25  Stampd                              0x000044e2 main + 130
        26  libdyld.dylib                       0x0431d701 start + 1
    )
    libc++abi.dylib: terminating with uncaught exception of type NSException
错误

[\uu NSArrayM objectAtIndex:]:索引2超出空数组的界限


显然,在尝试访问空数组时。将数组检查为alloc&init并在其中包含对象

将数组放入NSLog中的方法numberofrowsin部分。这将为您提供数组中的对象,如果数组为空,请检查您是否正确初始化了数组。如果没有,则在向数组中添加对象之前,先alloc和init数组。

您的数组是空的,您正试图访问它的第二个元素。您可以添加一些代码吗?看起来tableView:cellForRowAtIndexPath:正在尝试访问空数组或类似的内容。此错误为Objective 101。Google it man nsmutablearray超出空数组的界限