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

  • SEARCH
  • Home
  • 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 6910957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:52:57+00:00 2026-05-27T08:52:57+00:00

have a problem with object setters in a class. I have the class GEOImage,

  • 0

have a problem with object setters in a class.
I have the class GEOImage, where things like description, title etc. will be saved according
to an image.

@interface GEOImage : UIImage
{
    NSString *title;
    NSString *imgDescription;
    NSString *latitude;
    NSString *longitude;
    NSDictionary *editInfo;
}
@property (nonatomic, copy) NSString *title, *imgDescription, *latitude, *longitude;
@property (nonatomic, copy) NSDictionary *editInfo;
@end

Now i try to store a description out of another class:

self.chosenImage.imgDescription = @"description";

where chosenImage is of type GEOImage.

But i get the error:

-[UIImage setTitle:]: unrecognized selector sent to instance 0x939d220
2011-12-05 10:59:40.621 GeoPG[511:17c03] * Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[UIImage setTitle:]: unrecognized selector sent to instance 0x939d220’

If I’m looking in the debugger, the chosenImage is not NULL, and its been displayed correct in an image view.

Greets
s4lfish

  • 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-27T08:52:59+00:00Added an answer on May 27, 2026 at 8:52 am

    We can safely infer that chosenImage is not nil; if it were nil, sending it a message would simply do nothing, not crash.

    (Also, I’m assuming that you meant title rather than imgDescription in your usage sample, or that you implemented setImgDescription: to set the title in turn.)

    There are two possibilities:

    Dead object

    You created the image you stored to chosenImage as a GEOImage, but then it died while you were holding on to it. Subsequently, a UIImage (as identified in the exception message) was created at the same address, so the pointer you still hold now points to a UIImage. You sent a message to it that only works on GEOImages, but it’s only a UIImage, so it doesn’t respond to the message, which is the exception.

    The cause of an object dying while you’re holding it is that either you didn’t retain it somewhere where you should have, or you released it somewhere where you shouldn’t have. Or possibly both.

    Run your app under Instruments with the Zombies template. It will raise a flag when you hit this crash, and you can then investigate by clicking the button in that flag. Look at all of the Release and Autorelease events, starting from the end, to find the one that shouldn’t be there; then, if the release itself is unwarranted, take it out, or if it should be balanced by a previous retain, put one of those in.

    One possible cause of the crash is that you declared the chosenImage property as assign, but you should have declared it as retain/strong. If this is the problem, your Instruments findings will support it.

    Long-term, you should convert to ARC, which eliminates 90% of the cases where this problem could happen.

    You never created a GEOImage in the first place

    Just because you declared that chosenImage will hold a pointer to a GEOImage doesn’t mean it does. You can assign any object pointer there, and in many cases, the compiler doesn’t know if it isn’t actually a GEOImage.

    (They introduced a feature called “related result types” in a future version of Clang that should make this much less likely.)

    At a guess, I’d say you’re doing something like this:

    self.chosenImage = [GEOImage imageNamed:@"blah blah blah"];
    

    or this:

    self.chosenImage = [imagePicker takePicture];
    

    There is no reason to expect takePicture to return a GEOImage (how should it know that’s what you want?), and it’s likely that +[UIImage imageNamed:] (assuming you simply inherit it) won’t, either. Unless you create a GEOImage instance yourself, using alloc and an initializer, you cannot assume that any UIImage you get will be a GEOImage.

    The solution is to make it easy to create a GEOImage from a UIImage (which will involve wrapping this method), and then do that.


    Once you have a live (not dead) GEOImage (not UIImage) in your chosenImage property, it will work.

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

Sidebar

Related Questions

I have the following problem: I have the class: class Word(object): def __init__(self): self.id
Problem description: I have a POJO object, which is mapped from database. Which having
I have a problem with a flash object placing itself on top over everything
I have a problem using Linq to NHibernate to load an object and eagerly
I personally have no problem with the following code if (Object foo != null
I have a problem with my WPF program. I'm trying to create an object
I have a problem with IE causing two errors: 1. Object doesn't support this
I have an object I can serialize to XML without a problem. However when
My given problem is follow: I have an object with x columns and every
I have a data object with three fields, A, B and C. The problem

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.