Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 939459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:47:38+00:00 2026-05-15T21:47:38+00:00

Is Apple declaring method [CIImage initWithImage:(CIImage*)] that I’m not aware of? The only method

  • 0

Is Apple declaring method [CIImage initWithImage:(CIImage*)] that I’m not aware of? The only method with that signature that I’m aware of is [CISampler initWithImage:]. But when I tried to provide my own method, the compiler warns me saying that the method already exists.

Background: I’m trying to create a convenience method that converts an NSImage instance to CIImage. Then I created a category method [CIImage initWithImage:] that takes in an NSImage instance.

Here is the category method declaration:

@interface CIImage (QuartzCoreExtras) 
-(id) initWithImage:(NSImage*) img;
@end

I tried to use it in an NSImageView subclass to cache the CoreImage version of the image:

-(void) setImage:(NSImage *)newImage {
    [super setImage:newImage];
    [ciImage release];
    ciImage = [[CIImage alloc] initWithImage:newImage];
}

But when I compile the above method, I get a warning saying that someone else have already defined the method and it takes a different parameter:

warning: incompatible Objective-C types 'struct NSImage *', expected 'struct CIImage *' when passing argument 1 of 'initWithImage:' from distinct Objective-C type

From the “Jump to Definition” option in XCode, the only other implementation of the method (besides my own implementation) is [CISampler initWithImage:(CIImage*]. I’m really puzzled by this issue — is there anything I did wrong?

Just for completeness’ sake, here is the method body for [CIImage initWithImage:]:

@implementation CIImage (QuartzCoreExtras) 
-(id) initWithImage:(NSImage*) img {
    NSData* tiffData = [img TIFFRepresentation];
    NSBitmapImageRep* bitmap = [NSBitmapImageRep imageRepWithData:tiffData];
    return [self initWithBitmapImageRep:bitmap];    
}
@end

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T21:47:39+00:00Added an answer on May 15, 2026 at 9:47 pm

    At a guess, you haven’t included the header that defines your category into your .m file,

    The trick here is that [CIImage alloc] returns a value of type ‘id’. As such, they don’t know to limit the search just to the CIImage class, and instead look through all classes, which is why they find the definition in CISampler.

    I think if you change your code to this:

    ciImage = [ ((CImage*)[CIImage alloc]) initWithImage:newImage];
    

    you may get past the warning, since the compiler will have more of a clue about which version of initWithImage: to use.

    Having sad that, its bad form to do what you’ve done. Rename your method to initWithNSImage: – in the long run, it’ll be easier to support.

    (Apple should really have named their method initWithNSImage: but they seem to have generally reserved the right to remove the “NS” from their methods, and since its their framework, they win).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The Apple Developer Documentation (link is dead now) explains that if you place a
Does Apple's Xcode development environment provide any tools for memory leak detection? I am
It seems that Apple has so far gone the furthest of any mobile platform
Apple strongly recommends using the binary plist format when reading large XML-based data sets
Using the Apple OS X Cocoa framework, how can I post a sheet (slide-down
I've incorporated Apple's Reachability sample into my own project so I know whether or
In the Apple documentation for NSRunLoop there is sample code demonstrating suspending execution while
I have read the Apple documentation. They list the apps registered, yet in their
I saw the Apple keynote address and was very impressed by the new Places
I am considering buying an Apple MacBook Pro. Are there any pitfalls developing C#/.NET

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.