0

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.

Ahmad Kayyali
  • 8,233
  • 13
  • 49
  • 83

2 Answers2

2

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.

Krešimir Prcela
  • 4,257
  • 33
  • 46
  • Thanks for the response but it's not working! #import @protocol NSXMLParserDelegate; @interface Utility : NSObject { } Still have the same issue- – Ahmad Kayyali Nov 25 '10 at 10:58
  • Do you have still warning or just crashing? Did you implement all needed parsing functions in m file? – Krešimir Prcela Nov 25 '10 at 11:03
  • Yes Prcela this application used to work perfectly with no problems, now the application is not crashing but still got the warning should i be worried about the warning? – Ahmad Kayyali Nov 25 '10 at 11:20
  • This sounds as similar problem :/ http://stackoverflow.com/questions/2503723/error-building-project-with-nsxmlparserdelegate/2581750#2581750 – Krešimir Prcela Nov 25 '10 at 11:21
1

You can ignore that warning and you even should otherwise it wont run on older OSes.

About the crashing: Since the update to 4.2 i have the same problem when xmlparsing. The problem is that after the update the memory is getting filled and filled until the app crashes. The app had been working for months with no problem even with a hughe amount of data, those days are over. Unfortunately I dont know how to solve it properly. Have tried to find something in here but people keep insisting thats a bug in my code and that there is no change in the memory management...me i dont think so. Maybe there is really no change in memory management but then its another bug of iOS 4.2. I have limited my records now to 50 and it works a bit better...but thats not really a solution.

Hints are mostly welcome :-)

Michael
  • 11
  • 1