Comments (10)
The same thing seems to occur when inserting an item at the end of the gridView
...
I'm using an NSFetchedResultsController
so inside controller:didChangeObject:atIndexPath:forChangeType:newIndexPath:
I have this:
case NSFetchedResultsChangeInsert:
[self.gridView insertItemsAtIndices:[NSIndexSet indexSetWithIndex:newIndexPath.row] withAnimation:AQGridViewItemAnimationFade];
break;
When adding an item to the end of the gridView
, I am given this error:
Assertion failure in -[AQGridView fixCellsFromAnimation], AQGridView.m:788
CoreAnimation: ignoring exception: visible cell count after animation (6) doesn't match visible indices (7)
The app doesn't crash however, it keeps running with incorrect information backing the gridView
. The effect this has is that the gridView
is screwed up visually: some items are overlapping others, and there are empty spaces when rotating to landscape; also, when selecting one item, another item (the one next to the tapped one) is selected and when tapping the added item (it is visible!) this exception is thrown:
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[_PFBatchFaultingArray objectAtIndex:]: index (940903412) beyond bounds (6)'
One little thing that might or very well might not be related: It appears that gridView:cellForItemAtIndex:
is called twice for the just added item...
from aqgridview.
Huh, it looks like this happens when adding an item in the middle of the gridView
too...
This is what I see:
My own NSLog inside gridView:cellForItemAtIndex:
Visible cell list is missing some items!
Got 1 missing indices
My own NSLog inside gridView:cellForItemAtIndex:
*** Assertion failure in -[AQGridView fixCellsFromAnimation], AQGridView.m:788
CoreAnimation: ignoring exception: visible cell count after animation (6) doesn't match visible indices (7)
When adding an item to the beginning of the gridView
, I see no Assertion failure, but I do see this:
My own NSLog inside gridView:cellForItemAtIndex:
Visible cell list is missing some items!
Got 1 missing indices
My own NSLog inside gridView:cellForItemAtIndex:
from aqgridview.
Wow, this is getting weirder and weirder (for my non-Cocoa genius mind at least)...
I use this code to load some data into my Core Data store, as the app's still in very early beta, and adding data via the app doesn't work yet:
NSManagedObjectContext *managedObjectContext = self.fetchedResultsController.managedObjectContext;
NSManagedObject *languagePair = [managedObjectContext insertNewEntityWithName:@"LanguagePair"];
[languagePair setValue:@"English" forKey:@"foreignLanguage"];
[languagePair setValue:@"Dutch" forKey:@"ownLanguage"];
[languagePair setValue:[NSNumber numberWithInt:1] forKey:@"displayOrder"];
languagePair = [managedObjectContext insertNewEntityWithName:@"LanguagePair"];
[languagePair setValue:@"German" forKey:@"foreignLanguage"];
[languagePair setValue:@"Dutch" forKey:@"ownLanguage"];
[languagePair setValue:[NSNumber numberWithInt:2] forKey:@"displayOrder"];
NSError *error;
if (![managedObjectContext save:&error]) {
NSLog(@"%@", [error localizedDescription]);
}
(insertNewEntityWithName:
is in a category on NSManagedObjectContext
, as a proxy for NSEntityDescription
's insertNewObjectForEntityForName:inManagedObjectContext
)
This gives me this:
ChangeInsert: <NSIndexPath 0x15a400> 2 indexes [0, 0]
ChangeInsert: <NSIndexPath 0x15a450> 2 indexes [0, 1]
Loading cell for German
Program received signal: “EXC_BAD_ACCESS”.
The first two are my own NSLog
s in NSFetchedResultsController
's controller:didChangeObject:atIndexPath:forChangeType:newIndexPath:
, with the type of change, and the provided NSIndexPath
. The third is also one of my NSLog
s, one in gridView:cellForItemAtIndex:
, with the NSManagedObject
's foreignLanguage
.
The EXC_BAD_ACCESS
happens on AQGridViewUpdateInfo.m:775
.
At this point I'm not sure anymore if these are problems with your code or mine (as these are a LOT of problems), but my NSFetchedResultsController
handling seems to be fine...
If you need any more of my code to figure out what the heck is going wrong, please say so.
from aqgridview.
After a lot of stepping through the code managing the animation for inserting an item, it looks like on line 776 of AQGridViewUpdateInfo.m
([newVisibleCells addObject: item];
), item
isn't added to the newVisibleCells
NSMutableSet
, causing newVisibleCells
to have a count
1
lower than it should be, causing the assertion on line 788 of AQGridView.m
(NSAssert2([newVisibleCells count] == _visibleIndices.length, ...)
) to fail, causing the code after this failed assertion not to fire.
Why newVisibleCells
would not 'accept' item
, I don't know however...
from aqgridview.
After more stepping through the code, it seems that on line 769 of AQGridViewUpdateInfo.m
item
still contains the AQGridViewUpdateItem
from the fast enumeration, as expected, but on line 772, item
now points to 0x0
, which I guess is nil
, so item.animation
and item.index
both return 0
.
Thus, the AQGridViewAnimatorItem
is init
'd with an index
of 0
, and as an object with index == 0
already exists in the newVisibleCells
NSSet
, item
is not added to it, causing the problems I described above.
from aqgridview.
Yay, another weird crash with a really unhelpful call stack:
Stepping through the code, it looks like the objc_msgSend
fail happens on line 775 of AQGridViewUpdateInfo.m
, which reads AQGridViewAnimatorItem * item = [AQGridViewAnimatorItem itemWithView: cell index: item.index];
.
When I choose Jump over or Jump into while on this line, the application crashes, without actually going into itemWithView:index:
.
This happens when I try to add a first item to the gridView
(by adding a first NSManagedObject
to the NSManagedObjectContext
)
from aqgridview.
Is this still happening after last week's code dump? I certainly don't see it in the Kobo application, but there may be a little difference between our NSFetchedResultsController integration.
from aqgridview.
Let's hope it's fixed then :) Will check the big update out when I get home.
from aqgridview.
Yup, fixed! Thanks :D
from aqgridview.
Sweet :o)
from aqgridview.
Related Issues (20)
- Blinking or flashing of cells on scrolling
- Problem Spring Board Example
- Extending Springboard Example
- asynchronous image loading problem HOT 2
- Orientation change in ExpanderDemo
- ExpansionViewDemo - numberOfItemsInGridView
- Getting EXC_BAD_ACCESS in using AQGridView with Xib HOT 2
- Getting zero Objects in visibleCells and visibleCellIndices HOT 8
- reloaddata does not wipe out older cells
- reloadData does not invalidate selection
- AQGridView.m : updateVisibleGridCellsNow:Line-1584 - Memory leak
- updateNewGridDataAndCreateMappingTables for 64 bit HOT 7
- Hit test not working for cells in a second column + possible fix
- didSelectItemAtIndex:(NSUInteger)index not working properly HOT 1
- Grid Items are removed at random and my App crashes HOT 1
- EXC_BAD_ACCESS After XCode Validate Project Settings HOT 2
- book.h file not found
- Semantic Errors on upgrade to XCode 8
- XCode 8 error - 'objc_unretainedObject' is unavailable: use a (__bridge id) cast instead HOT 6
- Compiling error in Xcode 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aqgridview.