Here is my code in appdelegate.m
NSURL *url = [[NSURL alloc] initWithString:kBioXML];
NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url];
XMLParser *parser = [[XMLParser alloc]initXMLParser];
[xmlParser setDelegate:parser]; < - warning
XMLParser.h looks like
@class AppDelegate, Bio;
@interface XMLParser : NSObject {
NSMutableString *currentElementValue;
AppDelegate *appDelegate;
Bio *aBio;
NSString * bioText;
}
@property(nonatomic, retain) NSString *bioText;
- (XMLParser *) initXMLParser;
@end
And XMLParser.m
@implementation XMLParser
@synthesize bioText;
- (XMLParser *) initXMLParser{
[super init];
appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
bioText = @"";
return self;
}
The warning is “Sending XMLParser *” to parametr of incompatible type ‘id
what i should change to solve this warning?
thank you
Write this instead of your method..
Update
Implement NSXMLParserDelegate like this
In you .h file replace
@interface XMLParser : NSObjectwith@interface XMLParser : NSObject <NSXMLParserDelegate>got it?