Reputation: 4508
I have another strange bug which I cannot figure out.
I try to create a tableviewcell with the code below:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
TableViewCellController *cell = (TableViewCellController *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"TableViewCell" owner:self options:nil];
cell = [_cell autorelease];
_cell = nil;
}
// Configure the cell...
int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1];
Article *article = (Article *)[articles objectAtIndex: storyIndex];
cell.titleLabel.text = article.title;
cell.siteLabel.text = article.site.name;
cell.summaryLabel.text = article.description;
[article release];
return cell;
}
The problem is that I can populate the labels with any value, except with the description value. As soon as I do that I get a the following crash:
2010-12-22 16:07:13.165 iDoms[24086:207] CoreData: annotation: fault fulfilled from database for : 0x8b16dd0 Program received signal: “EXC_BAD_ACCESS”. warning: Unable to restore previously selected frame. Data Formatters temporarily unavailable, will re-try after a 'continue'. (Not safe to call dlopen at this time.)
with 62820 line items on the stack. I have no idea where to start figuring this out. I am used to Java, and Objective-C has been a real nightmare so-far regarding little strange bugs.
The Article class looks like this:
// Article.h
#import <CoreData/CoreData.h>
@class Site;
@interface Article : NSManagedObject
{
}
@property (nonatomic, retain) NSNumber * id;
@property (nonatomic, retain) NSString * title;
@property (nonatomic, retain) NSNumber * read;
@property (nonatomic, retain) NSString * link;
@property (nonatomic, retain) NSDate * pubDate;
@property (nonatomic, retain) NSString * description;
@property (nonatomic, retain) NSDate * lastUpdate;
@property (nonatomic, retain) Site * site;
@end
and
// Article.m
#import "Article.h"
@implementation Article
@dynamic id;
@dynamic title;
@dynamic read;
@dynamic link;
@dynamic pubDate;
@dynamic description;
@dynamic lastUpdate;
@dynamic site;
@end
The database contains data, and the particular field just the string "Test1". Any help is really appreciated as always!
Upvotes: 1
Views: 603
Reputation: 10083
I do not know if this is related to your current issue, but you do not want to do the [article release]; in your cellForRowAtIndexPath method, as objectAtIndex does not give you a reference that needs to be released.
Upvotes: 2
Reputation: 3300
The size of the stack trace leads me to believe that you've got an infinite recursion loop going somewhere.
I would look at the construction of the custom UITableViewCell that is getting created, namely the summaryLabel control and how it is wired into the cell.
I would also make sure that the articles array is property retained.
Upvotes: 3