Hi:
Im using Xcode 4 to parse an xml string in to a custom object. Ive followed a couple of online examples and can get it to work.
However, when I follow them I get an error with one of the lines of code. If I comment it out it works, but I'm concerned (as I'm new to this) that perhaps it will cause a problem down the line...
My problem is in initXML and the line is [super init];
With this in I get error: Result of delegate init call must be immediately returned or assigned to self.
If I comment it out it works.
Can someone explain, as I can't see a difference between examples online and my code...
.h
.m
Im using Xcode 4 to parse an xml string in to a custom object. Ive followed a couple of online examples and can get it to work.
However, when I follow them I get an error with one of the lines of code. If I comment it out it works, but I'm concerned (as I'm new to this) that perhaps it will cause a problem down the line...
My problem is in initXML and the line is [super init];
With this in I get error: Result of delegate init call must be immediately returned or assigned to self.
If I comment it out it works.
Can someone explain, as I can't see a difference between examples online and my code...
.h
Code:
#import <Foundation/Foundation.h>
@class MyRecord;
@interface XMLParser : NSObject
{
NSMutableString *currentElementValue;
MyRecord *record;
NSMutableArray *records;
}
@property (nonatomic, retain) MyRecord *record;
@property (nonatomic, retain) NSMutableArray *records;
- (XMLParser *) initXMLParser;
@end
.m
Code:
#import "XMLParser.h"
#import "MyRecord.h"
@implementation XMLParser
@synthesize record, records;
- (XMLParser *) initXMLParser
{
// [super init];
records = [[NSMutableArray alloc] init];
return self;
}