Compiler warning when passing NSError ** as a method parameter

Posted by splicer on Stack Overflow See other posts from Stack Overflow or by splicer
Published on 2010-04-07T11:03:22Z Indexed on 2010/05/31 2:32 UTC
Read the original article Hit count: 358

I've been scratching my head about this for the last 4 hours, trying out all kinds of little experiments, but I can't seem to figure out what's going wrong. Could this be a compiler bug?

Test.m:

- (id)initWithContentsOfURL:(NSURL *)aURL error:(NSError **)error
{
    if (!(self = [super init])) {
        return nil;
    }
    return self;
}

main.m:

NSError *error;

Test *t = [[Test alloc] initWithContentsOfURL:[NSURL fileURLWithPath:@"/"] error:&error];

Here's the compiler warning (from main.m):

warning: incompatible Objective-C types 'struct NSError **', expected 'struct NSDictionary **' when passing argument 2 of 'initWithContentsOfURL:error:' from distinct Objective-C type

I'm using the latest versions of Xcode and Snow Leopard.

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa