Spent 6 hours in Vein!


#1

i have been working on chapter 26 for more than 6 hours now trying to get the ChannelViewController to read " [channel detailTextLabel]" and i can say i havent even came close. For some reason everything is working up until this point. Ill admit i had to actually copy and paste the code for the URL on page 442 because no matter how many times i typed it it jsut wouldnt recognize the url and allow me to set strings on pg 451. Nothing i did worked but to copy and paste the code from the source files. I am trying to understand why my code isnt working for hours now and i cant wrap my head around it the RSS is getting picked up. The WebView works so Clearly the url works and the elements are being read. The RSSitems seem to be working.

I just can’t seem to figure out why this damn thing wont up the title and info cells in the ChannelView. Ill post the code for the channelview if anyone has any insight thank you !!!

[code] -(UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@“UITableViewCell”];

if (!cell) 
	cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2
								  reuseIdentifier:@"UITableViewCell"];

if ([indexPath row] == 0) {
		///put the title of the channel in row 0
		[[cell textLabel] setText:@"Title"];
		[[cell detailTextLabel] setText:[channel title]];
} else {
	//put the description
	[[cell textLabel] setText:@"Info"];
	[[cell detailTextLabel] setText:[channel infoString]];
}
      return cell;

}
[/code]

and my code for my other channel information is

[code]-(void)connectionDidFinishLoading:(NSURLConnection *)conn
{

// jsut checkign we are getting the info
NSString *xmlcheck = [[NSString alloc] initWithData:xmlData encoding:NSUTF8StringEncoding];
NSLog(@" xmlcheck = %@",xmlcheck);

/// create the parse object with data recieved from the webservice
NSXMLParser *parser = [[NSXMLParser alloc] initWithData:xmlData];
// give it a delegate
[parser setDelegate:self];
/// tell it to start the parser the document will still be parsed and the delegate of nsxmlparser will get all of its delegate messages sent to it before the lines are finished excuting it is block
[parser parse];

// get rid of the xml data we dotn need it any more
xmlData = nil;

// get rid of the connection we dont need it any more
connection = nil;

//reload the the table view but for now it will be empty
[[self tableView] reloadData];


NSLog(@"my channels name is %@",channel);
NSLog(@"my channels title  name is %@", [channel title]);
NSLog(@"my channels string info is %@",[channel infoString]);

}[/code]


#2

is there a reason for me to get this chapter to work i had to copy and past the whole channelViewController file which matches exactly my own code ?


#3

I don’t think this is your problem. Even the sample code doesn’t display the detailTitle.

I think the reason is the channel is not fully loaded when you created the “Info” button on ListViewController. Me too try to find out the solution for this problem.


#4

Vain not vein. Unless you really were in Fantastic Voyage. :wink:


#5

You should probably paste the entire code. There is a lot going on other than what you published.


#6

Hi millienheir,

I replaced my code with the two pieces of code you gave us, and it just works flawlessly. That of course means the bug is elsewhere, and we need to see the rest of your code to find it out.

Gilmar