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 7164245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:02:34+00:00 2026-05-28T14:02:34+00:00

I am currently facing the problem to check whether a property of an Object

  • 0

I am currently facing the problem to check whether a property of an Object (NSManagedObject) exists or not.

Unfortunately the method

[[MyObject class] respondsToSelector:@selector(myProperty)];

always returns NO.

I think it’s because the property generated by CoreData is a new style property ala

@property (nonatomic, strong) NSString *myProperty

So any ideas how to solve this issue?

I would really appreciate all of your suggestions 😉

Thanks in advance!
Alex

  • 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-28T14:02:35+00:00Added an answer on May 28, 2026 at 2:02 pm

    [[MyObject class] respondsToSelector:...] asks whether the metaobject responds to that selector. So, in effect, it asks whether there is a class method with that selector. Your code would return YES if you had:

    + (NSString *)myProperty;
    

    It returns NO because you have the equivalent of the instance method:

    - (NSString *)myProperty;
    

    You need to call respondsToSelector: on an instance of your class.

    You could normally use instancesRespondToSelector: directly on the metaclass (so, [MyObject instancesRespondToSelector:...]) but Core Data synthesises the relevant method implementations only when you create an object, so that’s a non-starter. You could however create an instance via the normal NSEntityDescription route and test respondsToSelector: on that.

    Since it’s all Core Data, an alternative would be to ask the NSManagedObjectModel for the relevant NSEntityDescription via its entitiesByName dictionary and inspect the entity description’s propertiesByName dictionary.

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

Sidebar

Related Questions

I'm currently facing a problem which I can not resolve and I really don't
I'm currently facing a problem where I should store my object structure on the
Im currently facing the problem that when i try to set focus on some
I'm currently facing new problem with operators. Using following code, I want to make
I'm currently facing this problem with ruby on rails 3, devise and facebook oauth.
I'm currently facing a weird problem while executing a command from my bash script.
I'm developing android application with phonegap . Currently I'm facing one problem with inputbox
I am currently working on a Wordpress blog installation. Problem i am facing is
I'm currently facing the problem that I want to serve static content via a
I'm currently facing a problem I haven't been able to solve myself. Basically what

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.