Here is the function where I get the compiler warning, I can’t seem to figure out what is causing it. Any help is appreciated.
-(void)displaySelector{
//warning on the following line:
InstanceSelectorViewController *controller = [[InstanceSelectorViewController alloc] initWithCreator:self];
[self.navController pushViewController:controller animated:YES];
[controller release];
}
Interface and implementation for the initWithCreator: method
-(InstanceSelectorViewController*)initWithCreator:(InstanceCreator*)creator;
-(InstanceSelectorViewController*)initWithCreator:(InstanceCreator*)crt{
if (self = [self initWithNibName:@"InstanceSelectorViewController" bundle:nil]) {
creator = crt;
}
return self;
}
I’m guessing this is not the only class in your project that has an
initWithCreator:method. In general, it is a bad idea to give static types to init methods.allocreturnsid, so the compiler doesn’t know the type of the object you’re sending the init method to. If there’s more than one choice, it will often guess wrong, and you’ll get the warning you see.