Hi guys, I have a problem debugging the iphone application that I am trying to write, and it made me depend on me, rush with me, I am n00b for programming and maybe I am misinterpreting the terminology, but I will try to explain it as best as possible .
The application receives the XML document from the website, parses it in an array and then displays it in a table, I have a parser in a separate file. The ViewDidLoad in the RootViewController sends the URL, the parser goes to work, and then returns an NSMutableArray.
When I run the application, it works fine with small XML files (5 records or so and 1-3 sections), but when I use a larger one (more than 20 lines, more than 12 sections), I get an error "- [CFString length] : message sent to the freed instance 0x3881940 "when I scroll the image at the bottom of the table, just as it will be indicated that the title of the last section is in the visible area on the screen.
if I return a static string instead of an object in my array in this method, it does not crash, but I can use NSLog to call the array and it returns the title without any problems.
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)indexPath {
return [[returnedEvents objectAtIndex:indexPath ] objectAtIndex:0];
}
An array of returned elements is not freed until - (void) dealloc {}
, , , , , ...
, .
**
.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
[[cell detailTextLabel] setText:[[[returnedEvents objectAtIndex:indexPath.section] objectAtIndex:indexPath.row + 1] objectForKey:@"Summary"]];
[[cell textLabel] setText:[[[returnedEvents objectAtIndex:indexPath.section] objectAtIndex:indexPath.row + 1] objectForKey:@"title"]];
return cell;
}
*
, , , , , , , .
#0 0x01be33a7 in ___forwarding___
#1 0x01bbf6c2 in __forwarding_prep_0___
#2 0x00066f13 in -[UITableView(UITableViewInternal) _delegateWantsHeaderForSection:]
#3 0x00069fe2 in -[UITableView(_UITableViewPrivate) _updateVisibleHeadersAndFootersNow]
#4 0x000727e4 in -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow]
#5 0x00069953 in -[UITableView layoutSubviews]
#6 0x02f482b0 in -[CALayer layoutSublayers]
#7 0x02f4806f in CALayerLayoutIfNeeded
#8 0x02f478c6 in CA::Context::commit_transaction
#9 0x02f4753a in CA::Transaction::commit
#10 0x02f4f838 in CA::Transaction::observer_callback
#11 0x01bbb252 in __CFRunLoopDoObservers
#12 0x01bba65f in CFRunLoopRunSpecific
#13 0x01bb9c48 in CFRunLoopRunInMode
#14 0x01d6078d in GSEventRunModal
#15 0x01d60852 in GSEventRun
#16 0x00023003 in UIApplicationMain
#17 0x00002a20 in main at main.m:14
, :
NSURL *XMLURLPath = [[NSURL alloc] initWithString:@"http://www.localendar.com.au/events/database_xml.php?day=2010-05-01&endday=2010-05-30"];
returnedEvents = [[NSMutableArray alloc] initWithArray:[localoXMLParser parseXMLDataWithURL:XMLURLPath]];
[XMLURLPath release];
, ? , , - ?