Compiler warning when passing NSError ** as a method parameter
- by splicer
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.