Specifically the warning is: “Incompatible Objective-C types ‘struct NSString *’, expected ‘struct UIImage *’ when passing argument 4 of ‘objectWithType:name:code:image’ from distinct Objective-C type”. It follows a line that looks like so:
[Object objectWithType:@"Type" name:@"Name" code:@"0001" image:@"image.png"],
So, I understand that I created the class Object to take type UIImage, but I am providing it with type NSString. Here’s the problem: I don’t know how to indicate the image differently than its file name.
(Apologies if this is a basic problem. I’m new to this and trying to look for solutions before posting here. Any help you can offer is appreciated.)
You actually need an instance of
UIImage, which you understand. So, the class methodimageNamed:is typically used for this:Another option (since you are using all strings here) might be to rewrite your method so that it takes a name instead of an image and then create the image inside the method implementation. So you might define the method: