views:

104

answers:

2
- (void)parserDidStartDocument:(NSXMLParser *)parser
{
    nestedChannels = [ [ NSMutableArray alloc ] init ];
    ....
}

- (void)parser:(NSXMLParser *)parser didStartElement....
{
    Channel *channel = [ [ Channel alloc ] init ];
    [ nestedChannels addObject:channel ];
    ....
}

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string....
{
    Channel *channel = [ nestedChannels lastObject ];
    channel.thumbnail = string;
    ....
}

@interface Channel : NSObject {

NSMutableString *thumbnail;

}


@property (nonatomic, retain) NSMutableString *thumbnail;

Error: * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[NSCFString thumbnail]: unrecognized selector sent to instance 0x381c350'

It's like is not able to recognize the type of the object. Am I missing something

*nestedChannels is a NSMutableArray

A: 

It's unclear what you're asking; are these different methods? Your code formatting is a little odd. One thing to note is that, if the second snippet is indeed a method (though there are no brackets), you need to append the data passed in, as it may not be a complete element:

if (channel.name == nil) channel.name = [NSMutableString string];
[channel.name appendString: string];
Ben Gottlieb
A: 

Seems like this is causing the problem.

channel.thumbnail = string;

What type is thumbnail in channel and what mutators are available? To me it looks like it is trying to set string to thumbnail but there's no setter that accepts string on thumbnail. Is thumbnail NSString?

stefanB
I added the Channel class, sorry
Xavi Colomer
you are trying to assign NSString to NSMutableString, normally that works with some warnings but maybe there's some issue with KVC, difference between setting mutable and non-mutable string in KVC? Have you tried to make mutable copy and assign that to thumbnail?
stefanB