Ios ';NSInvalidArgumentException';:尝试滚动到无效的索引路径

Ios ';NSInvalidArgumentException';:尝试滚动到无效的索引路径,ios,exception,uicollectionview,Ios,Exception,Uicollectionview,这是我制作CollectionViewCustomCells动画的代码 -(void)viewDidAppear:(BOOL)animated{ rowIndex = 0; [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(target

这是我制作CollectionViewCustomCells动画的代码

-(void)viewDidAppear:(BOOL)animated{

    rowIndex = 0;

    [NSTimer scheduledTimerWithTimeInterval:1.0
                                     target:self
                                   selector:@selector(targetMethod)
                                   userInfo:nil
                                    repeats:YES];
}

-(void)targetMethod
{
    [self.offerCollectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:rowIndex inSection:1]
                      atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally
                              animated:YES];

    rowIndex=(rowIndex<parserDataContentArrayForExhibitor.count-1)?(rowIndex+1):0;

//    if (rowIndex == parserDataContentArrayForExhibitor.count) {
//        rowIndex = 0;
//    }


}


Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'attempt to scroll to invalid index path: <NSIndexPath 0xab55110> 2 indexes [1, 0]'
请帮帮我,因为这对我来说有点陌生

多谢各位


致以最诚挚的问候。

如果出现以下情况,请将此行保存在
内:

if (parserDataContentArrayForExhibitor.count > 0) {
 rowIndex = (rowIndex<parserDataContentArrayForExhibitor.count - 1) ? (rowIndex + 1) : 0;
}

你们有多少部分?章节从索引0开始。@nikhitadkslfslg:我只有一个章节。@nikhitadkslfslg:请检查编辑的问题。
instation=0
可以。问题可能出在
rowIndex
@nikhitadkslfslg上:那么我是否需要将rowIndex更改为1,或者可能将其写入VDL或任何其他方法中???
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'attempt to scroll to invalid index path: <NSIndexPath 0xab22ea0> 2 indexes [0, 0]'
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{

    return 1;
}
if (parserDataContentArrayForExhibitor.count > 0) {
 rowIndex = (rowIndex<parserDataContentArrayForExhibitor.count - 1) ? (rowIndex + 1) : 0;
}
[self.offerCollectionView scrollToItemAtIndexPath: [NSIndexPath indexPathForItem: rowIndex inSection: 0];
                  atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally
                          animated:YES];