Priesto
Priesto

Reputation: 61

Why will my NSObject not work as a NSXMLParserDelegate?

I'm trying to use an NSXMLParser to parse a property file that is related to my main document type. Originally I tried creating a method in my document that should have created an NSXMLParser then set itself as the delegate. As so:

NSXMLParser *infoParser = [NSXMLParser alloc] init];

[infoParser setDelegate:self];

This just brings up a warning that I'm passing an incompatible id. I've looked through the documentation and added all of the optional methods for NSXMLParserDelegates along with now moving this implementation to an NSObject. But still incompatible id. Is there something I should be doing extra? Beyond including methods mentioned here, what do i need to do to conform to this protocol?

Upvotes: 1

Views: 131

Answers (2)

vikingosegundo
vikingosegundo

Reputation: 52227

you need to declare your interface as conforming to NSXMLParserDelegate protocol

@interface MyClass <NSXMLParserDelegate>{

}
@end

and implement at least all required methods.

Upvotes: 2

akashivskyy
akashivskyy

Reputation: 45190

Add < NSXMLParserDelegate > in @interface YourObject : NSObject line in your .h file and the error should dosappear

Upvotes: 1

Related Questions