NSXMLParser
has been available since iPhone OS 2.0. The delegate protocol has always been available as well, but prior to iOS 4.0 NSXMLParserDelegate
was what is called an informal protocol, e.g. not explicitly defined.
As of iOS 4.0 many protocols that where previously informal has been promoted to actual format protocols, NSXMLParserDelegate
is one of them.
The warning you get about not conforming to the protocol is building against SDK 4.0 and later, or missing protocol if building against an earlier SDK can be remedied by conforming to the protocol conditionally as such:
@interface MyClass : NSObject
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
<NSXMLParserDelegate>
#endif
{
// Your ivars here
}
// And methods here as usual
@end
Or you can make the compiler shut up by casting your delegate to id
when setting it like this:
[myXMLParser setDelegate:(id)self]; // Assuming self is the delegate