Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Littleodie914

macrumors 68000
Original poster
Jun 9, 2004
1,813
8
Rochester, NY
Hey guys, this is more a shot in the dark than anything else, I made a few changes to my UITableViewCell code, and began receiving the following error *after a value was added to the tableview, and after it was told to reload data.*

The sequence is:

1) Modal window opens
2) User clicks a "create" button"
3) The creation, addition, and data reloading occurs
4) The tableview "below" the modal window is re-displayed

Problem 4 is where the error occurs, but since there's no user-accessible code to trace through and find the error, I'm a bit stuck. Here's what I'm getting:

Code:
Code Type:       X86 (Native)
Parent Process:  launchd [112]

Date/Time:       2008-04-09 08:23:39.342 -0400
OS Version:      Mac OS X 10.5.2 (9C7010)
Report Version:  6

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000fffffffc
Crashed Thread:  0

Thread 0 Crashed:
0   UIKit                         	0x30c70a4d -[UITableViewRowData rectForRow:inSection:] + 188
1   UIKit                         	0x30b5110f -[UITableView(_UITableViewPrivate) _adjustExtraSeparators] + 392
2   UIKit                         	0x30b47bab -[UITableView layoutSubviews] + 110
3   QuartzCore                    	0x0018070b -[CALayer layoutSublayers] + 50
4   QuartzCore                    	0x00180635 CALayerLayoutIfNeeded + 172

Do you guys know of any way to debug this error, or to figure out which of the arguments being passed to the UITableViewRowData object are problematic? Or what values are being passed back at all? Thanks! :D
 

Spike099

macrumors regular
Feb 18, 2007
143
0
Canada
Whenever i've seen the EXEC_BAD_ACCESS, it's been caused by myself releasing and freeing an object too soon, and later trying to access/send it a message. My advice is to check your properties, make sure their retained properly and of course released when they need to be.
 

Littleodie914

macrumors 68000
Original poster
Jun 9, 2004
1,813
8
Rochester, NY
it would be a lot easier to diagnose if you showed us the interesting bits of code.
That's the thing, this is "internal" code. I have no access to the line of code where the error occurs, thus I have no access to the variables being passed to the rectForRow:inSection: method.

That's what I'm ultimately trying to determine: Is there any way to view this section of code, or debug it in any way?

Edit: As a bit more clarification, there's a "Done" button at the top of my modal window, which when pressed, executes the following code:

Code:
- (void)createSubject:(id)sender {
	NSLog(@"1");
	if ([titleTextField text] != nil)
		[tempSubject setTitle:[titleTextField text]];
	else
		[tempSubject setTitle:@"New Subject"];
	NSLog(@"2");
	if ([noteTextField text] != nil && [noteTextField text] != @"" && [noteTextField text] != @" ")
		[tempSubject setNote:[noteTextField text]];
	NSLog(@"3");
	[tempSubject setHue:[colorSlider value]];
	[tempSubject setAssignments:[[NSMutableArray alloc] init]];
	NSLog(@"4");
	[APP_DELEGATE.subjects addObject:tempSubject];
	NSLog(@"5");
	[[((IPM_SubjectsViewController *)[[APP_DELEGATE.firstNavigationController viewControllers] objectAtIndex:0]) subjectsTableView] reloadData];
	NSLog(@"6");
	[APP_DELEGATE.firstNavigationController dismissModalViewControllerAnimated:YES];
	NSLog(@"7");
}

This code all executes correctly, down to the printing of the 7. It is after this point that the app explodes, with the stack trace posted above. What, logically, should happen after the ModalViewController is dismissed? (So I know where I should look next.)

I can't seem to determine what changes in my code spurred the sudden error, but any help is appreciated. :)
 

cmaier

Suspended
Jul 25, 2007
25,405
33,474
California
I'm more interested in the tableviewcell code you changed.

Remember that if you mess up memory in one piece of code, you can get a crash in a completely unrelated bit of code. I'm assuming that when you changed the tableviewcell code you ended up dealloc'ing something that is later used, or you used something that's never been alloc'd.
 

Littleodie914

macrumors 68000
Original poster
Jun 9, 2004
1,813
8
Rochester, NY
Wow, finally figured it out. I went through an older backup I had made, and compared the code line by line for changes. Turns out the erroneous stuff was in my App Delegate, in the following code:

Code:
//self.smartGroups = [[NSMutableArray alloc] init]; Old Code
		
// Begin New Code
		NSMutableArray *newGroups = [NSMutableArray new];
		IPM_ModelGroup *newGroup = [[IPM_ModelGroup alloc] initWithTitle:@"Spiffy Smart Group" subjects:[NSArray new] dayRange:7];
		IPM_ModelGroup *newGroup2 = [[IPM_ModelGroup alloc] initWithTitle:@"New Group" subjects:[NSArray new] dayRange:14];
		
		[newGroups addObject:newGroup];
		[newGroups addObject:newGroup2];
		
		self.smartGroups = newGroups;
// End New Code

Notice the commented out line of "Old Code." For some reason the tableview was unable to get the smart groups from the app delegate. Why would an object that had obviously been allocated an initialized cause an issue? (As the new code works fine.) :confused:
 

Sbrocket

macrumors 65816
Jun 3, 2007
1,250
0
/dev/null
I guess you found the new -[UITableView dequeueReusableCellWithIdentifier:] method that replaced availableCell: on the tableView:cellForRowAtIndexPath: delegate method, then. My UITableView that I've been piecing together really started acting weird this time around with Beta 3 of the SDK. Selections don't seem to work if you don't use -[UITableView dequeueReusableCellWithIdentifier:] to recycle cells in tableView:cellForRowAtIndexPath:, and selecting something then scrolling ends up with some weird behavior too. Not to mention it'll select multiple cells. So confusing...I love API changes so much. :mad:
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
Littleodie914, I'd suggest not using new. It's kind of old school. Use alloc/init instead. Also, new returns an object with a retain count of 1 that is not autoreleased, so that code above is leaking memory. Instead of [NSMutableArray new] use [NSMutableArray array] which returns an autoreleased object.
 

cmaier

Suspended
Jul 25, 2007
25,405
33,474
California
I guess you found the new -[UITableView dequeueReusableCellWithIdentifier:] method that replaced availableCell: on the tableView:cellForRowAtIndexPath: delegate method, then. My UITableView that I've been piecing together really started acting weird this time around with Beta 3 of the SDK. Selections don't seem to work if you don't use -[UITableView dequeueReusableCellWithIdentifier:] to recycle cells in tableView:cellForRowAtIndexPath:, and selecting something then scrolling ends up with some weird behavior too. Not to mention it'll select multiple cells. So confusing...I love API changes so much. :mad:

Where (if anywhere) is that thing documented? Can't seem to find it in the docs xcode is using.
 

Littleodie914

macrumors 68000
Original poster
Jun 9, 2004
1,813
8
Rochester, NY
The docs aren't updated, but if you check the header files its there and its shown in the API Beta 2 to Beta 3 changes.
Does anyone know why the documentation isn't being updated? After all, that's where Xcode gets its auto-completion "dictionary," and it's pretty frustrating to have it tell you "Oh sure, I know what you mean!" and insert the rest of a method, only to find out it's deprecated and crashes your app. :mad:
 

Sbrocket

macrumors 65816
Jun 3, 2007
1,250
0
/dev/null
Does anyone know why the documentation isn't being updated? After all, that's where Xcode gets its auto-completion "dictionary," and it's pretty frustrating to have it tell you "Oh sure, I know what you mean!" and insert the rest of a method, only to find out it's deprecated and crashes your app. :mad:

Its been updated now. I seem to remember clicking update for a few doc sets earlier so it much just take them a day or so to get the doc updates out.
 

Littleodie914

macrumors 68000
Original poster
Jun 9, 2004
1,813
8
Rochester, NY
Littleodie914, I'd suggest not using new. It's kind of old school. Use alloc/init instead. Also, new returns an object with a retain count of 1 that is not autoreleased, so that code above is leaking memory. Instead of [NSMutableArray new] use [NSMutableArray array] which returns an autoreleased object.
Ah, thanks. I knew there was a small difference between the two, but I always thought "new" was just a convenience method.

Also, I ran into this same problem again, and it turns out a few of my properties had been declared with the nonatomic attribute, which was causing some reference/thread issues as well. :eek:
 

Littleodie914

macrumors 68000
Original poster
Jun 9, 2004
1,813
8
Rochester, NY
Back again guys, running into the same issue. Now it's when I try to delete a row from my tableview. Here's the stacktrace:

Code:
Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000fffffffc
Crashed Thread:  0

Thread 0 Crashed:
0   UIKit                         	0x30c95f1d -[UITableViewRowData rectForRow:inSection:] + 188
1   UIKit                         	0x30c954c8 -[UITableViewRowData rectForGlobalRow:] + 147
2   UIKit                         	0x30b6d9f2 -[UITableView(_UITableViewPrivate) _updateWithItems:withOldRowData:] + 11183
3   UIKit                         	0x30b622ba -[UITableView(_UITableViewPrivate) _endCellAnimations] + 644
4   iProcrastinate Mobile         	0x000044ac -[IPM_SubjectsViewController tableView:commitEditingStyle:forRowAtIndexPath:] + 768 (IPM_SubjectsViewController.m:148)
5   UIKit                         	0x30b697ed -[UITableView(UITableViewInternal) animateDeletionOfRowWithCell:] + 95
6   UIKit                         	0x30bb93d8 -[UIRemoveControl _doRemove:] + 199
7   UIKit                         	0x30b26e30 -[UIApplication sendAction:to:from:forEvent:] + 116

And here's the line of code that it's breaking at:

Code:
[subjectsTableView deleteRowsAtIndexPaths:pathArray withRowAnimation:UITableViewRowAnimationFade];

I'm getting confused. I have no idea how to debug something like this! Any tips would be greatly appreciated. :)
 

Littleodie914

macrumors 68000
Original poster
Jun 9, 2004
1,813
8
Rochester, NY
Hmm, I just realized that after deleting a row, then adding new rows, I start seeing weird GUI inconsistencies as well.:confused:
 

Attachments

  • Picture 2.png
    Picture 2.png
    29 KB · Views: 95

Littleodie914

macrumors 68000
Original poster
Jun 9, 2004
1,813
8
Rochester, NY
Hmm... It seems like this might be an Apple bug? I built the *most basic* UITableView I could, and any reordering/deleting caused this flaw.

When I switch to a "Plain" table view, however (as opposed to a "Group" table view), there're no issues. :confused:

Edit: This issue remains unfixed in the new Beta 4 of the SDK, I've filed a bug report with Apple. If I hear anything back, I'll post it here.

Edit 2: Got an email back from Apple. It's a documented bug, and they're working on a fix. :)
 

blankmind

macrumors newbie
Jun 23, 2008
1
0
Has the deleteRowsAtIndexPaths:withAnimation bug been fixed?

Hello,

I am using the Beta 7 and have come across the problem you have described (tableView deleteRowsAtIndexPaths:withAnimation) when trying to delete table rows. It happens, for me, just with the top row (pretty much the same stack trace) - all other rows delete fine. Does this now work for you or is it still causing problems?

Any help with this would be greatly appreciated!
 

sujithkrishnan

macrumors 6502
May 9, 2008
265
0
Bangalore
Hmm, I just realized that after deleting a row, then adding new rows, I start seeing weird GUI inconsistencies as well.:confused:

Hi.

I just want to know what image u used in ur view (screenshot u pasted) so as to get the iPhone native app look n feel??
Is that gradient is available???
I am searchiung for this background ...
Please help...
 

Littleodie914

macrumors 68000
Original poster
Jun 9, 2004
1,813
8
Rochester, NY
Hi.

I just want to know what image u used in ur view (screenshot u pasted) so as to get the iPhone native app look n feel??
Is that gradient is available???
I am searchiung for this background ...
Please help...
Hi. :)

If you're talking about the blue striped background, it's added automatically behind a grouped UITableView. I don't know if it's accessible outside of that.
 

rockman

macrumors newbie
Jan 1, 2009
3
0
Has anyone found the solution to this issue? I have the same problem,
multiple sections in a tableview and when numbofsections = 1, all is grand, but when > 1, crashed on delete.

Basically I have rows broken up into "months of the year", and I have tried returning static int, as well as dynamic int based on the actual months that are in the dataSource.


thanks in advance.
Rockman
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.