I'm trying to create an NSXMLParser and call its delegate methods. On setting the delegate to self (2nd line below) I get a warning Sending 'XMLParserViewController *' to a parameter of incompatible type 'id <NSXMLParserDelegate>'.
What am I missing here?
NSXMLParser *parser = [[NSXMLParser alloc]initWithData:data];
[parser setDelegate:self];
[parser parse];
[parser release];
Change the line: @interface XMLParserViewController : UIViewController
(in your .h file) to:
@interface XMLParserViewController : UIViewController <NSXMLParserDelegate>
You forgot to set your UIViewController as a delegate of the delegate (if you will).
In the declaration of self you should have:
@interface YourClass <NSXMLParserDelegate>
to let the compiler know that your class conforms to the NSXMLParserDelegate
protocol.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With