Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-29-2011, 01:43 PM   #1 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 18
Jean Jacques is on a distinguished road
Default Sending ABC to a parameter of incompatible type 'id<NSXMLParserDelegate>

Hello guys, my app is working (almost...) the way I want it to, but I want to have a 0 error/warning app and I can't figure this one out..

My code:

Code:
@implementation VideoController

-(void)awakeFromNib
{
	NSString *dataFilePath = [[NSBundle mainBundle] pathForResource:@"video" ofType:@"xml"];
	stories = [[NSMutableArray alloc]init];
	parser = [[NSXMLParser alloc] initWithData:[NSData dataWithContentsOfFile:dataFilePath]];
	[parser setDelegate:self];
	[parser parse];
	NSLog(@"file trovato e caricato");

}
The warning, applying to the line above "[parser setDelegate:self];", is actually double:

Quote:
Class 'VideoController' does not implement the 'NSXMLParserDelegate' protocol
Quote:
Sending 'VideoController' to parameter of incompatible type 'id<NSXMLParserDelegate>'
I guess this part of the NSXMLParser.h file might relate to the above, since Xcode indicates it under Semantic issue relating to the warning "Sending...":

"- (void)setDelegateid <NSXMLParserDelegate>)delegate;" as follows:

Quote:
1. Passing argument to parameter 'delegate' here
...and this is the context (in the .h file)

Code:
@interface NSXMLParser : NSObject {
@private
    void * _parser;
    id _delegate;
    id _reserved1;
    id _reserved2;
    id _reserved3;
}
- (id)initWithContentsOfURL:(NSURL *)url;  // initializes the parser with the specified URL.
- (id)initWithData:(NSData *)data; // create the parser from data

// delegate management. The delegate is not retained.
- (id <NSXMLParserDelegate>)delegate;
- (void)setDelegate:(id <NSXMLParserDelegate>)delegate;

What am I missing here? I am programming trial & error and am a total noob, so I will be very grateful for instruction in plain words, thanks a million

Last edited by Jean Jacques; 08-29-2011 at 01:56 PM.
Jean Jacques is offline   Reply With Quote
Old 08-29-2011, 01:58 PM   #2 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

Your VideoController should adopt the NSXMLParserDelegate. Just add it in the header file.

On a side note, trial and error is really not a good approach in this field. You shouldn't be struggling with basics like this after a year. I suggest you read this document to learn the basic concepts of the platform: Loading… then this Loading… to learn the Objective C syntax.
baja_yu is offline   Reply With Quote
Old 08-29-2011, 03:55 PM   #3 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 18
Jean Jacques is on a distinguished road
Default

Quote:
Originally Posted by baja_yu View Post
Your VideoController should adopt the NSXMLParserDelegate. Just add it in the header file.

On a side note, trial and error is really not a good approach in this field. You shouldn't be struggling with basics like this after a year. I suggest you read this document to learn the basic concepts of the platform: Loading… then this Loading… to learn the Objective C syntax.
Thanks a lot for your quick input. I tried to add "NSXMLParserDelegate" to both .m and .h file, but as soon as I did it, there was a red warning... Could you please tell me where precisely should I put it?

On a side note, totally agree, I will be learning fundamentals as soon as I get rid of this app which I really need to complete asap
Jean Jacques is offline   Reply With Quote
Old 08-29-2011, 05:46 PM   #4 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

There are no red warnings, those are errors. And it would help if you posted the exact error message. Also post what you tried when you added the delegate to the class.
baja_yu is offline   Reply With Quote
Old 03-14-2012, 03:02 PM   #5 (permalink)
Registered Member
 
Join Date: Mar 2012
Posts: 1
stuartervine is on a distinguished road
Default Belated response!

Hi Jean,

I realise this is a very late response to your question, however it came out as the number 1 google hit on searching for 'passing argument to parameter', so I thought I'd respond with another case where this can happen.

I've found the 'passing argument to parameter' note occurs when a usage of the method the note is against actually receives an incompatible type. If this is the case, you should see a corresponding warning in your compile output stating something like... 'incompatible pointer types sending 'NSString *' to parameter of type 'MyObject *'. When you correct this warning, the note should disappear.

Last edited by stuartervine; 03-14-2012 at 03:13 PM.
stuartervine is offline   Reply With Quote
Reply

Bookmarks

Tags
iphone, mobile applications, xcode

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 391
6 members and 385 guests
JackReidy, jeroenkeij, Sami Gh, yomo710, Yosh_K
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,671
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, JackReidy
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:49 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0