Search code examples
objective-cipadnsxmlparserios-4.2

iOS SDK NSXMLParserDelegate Warning


I have an application running SDK 3.2, I am using NSXMLParserDelegate for parsing XML.

I upgraded it to SDK 4.2 and my application keeps crashing when using the NSXMLParserDelegate, a warning said:

'Class' does not implement the 'NSXMLParserDelegate' protocol

I have tried the following:

  • Add the protocol to my class NSObject <NSXMLParserDelegate>
  • #import <Foundation/NSXMLParser.h>

But all my attempt had failed, please any help is so much appreciated.


Solution

  • Import the Foundation/NSXMLParser.h in header file and just put this line before your interface declaration:

    @protocol NSXMLParserDelegate;
    // ... and this code you already have but just to be sure it is written as:
    @interface SomeYourClass <NSXMLParserDelegate> {
    

    This is a forward declaration of protocol that is actually missing in newer version of NSXML parser.