strange run time error message from CIImage initWithContentsOfURL

Posted by Adam on Stack Overflow See other posts from Stack Overflow or by Adam
Published on 2010-06-05T21:52:31Z Indexed on 2010/06/05 22:02 UTC
Read the original article Hit count: 264

Filed under:
|

When executing the following code I receive a run time error when the code executes the second line of code. The error (which shows up in the debugger) says: [NSButton initWithContentsOfURL:]: unrecognized selector sent to instance 0x100418e10. I don't understand this message, because it looks to me (based on my source code) like the initWithContentsOfURL message is being sent to the myImage instance (of the CIImage class) ... not NSButton. Any idea what is going on?

If it matters ... this code is in the Application Controller class module of an Xcode project (a Cocoa application) -- within a method that is called when I click on a button on the application window. There is only the one button on the window ...

// Step1: Load the JPG file into CIImage
NSURL *myURL = [NSURL fileURLWithPath:@"/Users/Adam/Documents/Images/image7.jpg"];
CIImage *myImage = [myImage initWithContentsOfURL: myURL];
if (myImage = Nil) {
    NSLog(@"Creating myImage failed");
    return;
}
else {
    NSLog(@"Created myImage successfully");
}

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa