相关疑难解决方法(0)

UICollectionView断言失败

我在执行insertItemsAtIndexPaths中遇到此错误UICollectionView

断言失败:

-[UICollectionViewData indexPathForItemAtGlobalIndex:], 
/SourceCache/UIKit/UIKit-2372/UICollectionViewData.m:442
2012-09-26 18:12:34.432  
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', 
reason: 'request for index path for global index 805306367 
when there are only 1 items in the collection view'
Run Code Online (Sandbox Code Playgroud)

我检查过,我的数据源只包含一个元素.有关为何会发生这种情况的任何见解?如果需要更多信息,我绝对可以提供.

objective-c ios6 uicollectionview

59
推荐指数
3
解决办法
4万
查看次数

iOS中的NSInternalInconsistencyException posErrorMarker错误

我收到一个无法确定性地重新创建的随机错误,这使得调试很麻烦.例外是

NSInternalInconsistencyException {Rows:0x1e5eb080.posErrorMarker == 1 + 1*0x1e5eb080.negError + 1*0x1fa51a40.marker 0x1f933020.negError == 274 + 1*0x1f933020.posErrorMarker + -1*0x1fb84100.marker 0x1fb8d610.negError == 274 + -1

> 
0CoreFoundation 0x32c1b3e7 + 162
1libobjc.A.dylib 0x3a916963 objc_exception_throw + 30
2CoreFoundation 0x32c1b307 + 106
3Foundation 0x335ce24f + 190
4Foundation 0x335d0871 + 60
5Foundation 0x335d19e9 + 624
6Foundation 0x335d9eab + 230
7UIKit 0x34e6211b + 162
8UIKit 0x34e67b9f + 26
9CoreFoundation 0x32b61acd CFArrayApplyFunction + 176
10UIKit 0x34e67bdf + 90
11CoreFoundation 0x32b61acd CFArrayApplyFunction + 176
12UIKit 0x34e67bdf + 90
13CoreFoundation 0x32b61acd CFArrayApplyFunction …
Run Code Online (Sandbox Code Playgroud)

core-data objective-c-blocks ios6 uicollectionview

8
推荐指数
0
解决办法
779
查看次数

CollectionView + UIKit Dynamics在performBatchUpdates上崩溃:

我遇到了一个奇怪的崩溃并试图整天修复它.我有一个自定义UICollectionViewLayout,它基本上增加了细胞的重力和碰撞.

实施效果很好!当我尝试使用以下命令删除一个单元格时会出现问题:[self.collectionView performBatchUpdates:].

它给了我以下错误:

2013-12-12 21:15:35.269 APPNAME[97890:70b] *** Assertion failure in -[UICollectionViewData validateLayoutInRect:], /SourceCache/UIKit_Sim/UIKit-2935.58/UICollectionViewData.m:357

2013-12-12 20:55:49.739 APPNAME[97438:70b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UICollectionView recieved layout attributes for a cell with an index path that does not exist: <NSIndexPath: 0x975d290> {length = 2, path = 0 - 4}'
Run Code Online (Sandbox Code Playgroud)

我的模型处理正确,我可以看到它从中删除项目!

要删除的项的indexPaths正在对象之间正确传递.collectionView更新没有崩溃的唯一时间是我删除它上面的最后一个单元格,否则,崩溃就会发生.

这是我用来删除单元格的代码.

- (void)removeItemAtIndexPath:(NSIndexPath *)itemToRemove completion:(void (^)(void))completion
{
    UICollectionViewLayoutAttributes *attributes = [self.dynamicAnimator layoutAttributesForCellAtIndexPath:itemToRemove];

    [self.gravityBehaviour removeItem:attributes];
    [self.itemBehaviour removeItem:attributes];
    [self.collisionBehaviour removeItem:attributes];

    [self.collectionView performBatchUpdates:^{
        [self.fetchedBeacons removeObjectAtIndex:itemToRemove.row];
        [self.collectionView deleteItemsAtIndexPaths:@[itemToRemove]];
    } completion:nil];   
} …
Run Code Online (Sandbox Code Playgroud)

objective-c ios uicollectionview uicollectionviewlayout uikit-dynamics

7
推荐指数
1
解决办法
4984
查看次数