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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:26:12+00:00 2026-05-16T18:26:12+00:00

I have some Entities holding values for my program. E.g. a Person Entity has

  • 0

I have some Entities holding values for my program.
E.g. a “Person” Entity has synthesized properties for the values “name”, “age”, “address” etc.

I wish to build a “printMe” method on the Entity, so that invoking this method results in the above properties being printed to the console like “\nPropertyName:Value”.

I have done this with Core Data Entities before by using something like this:

- (void) printMe {

NSEntityDescription *entity = [NSEntityDescription entityForName:@"NewAirline" inManagedObjectContext:[self managedObjectContext]];

for (NSString *attr in [entity attributesByName]) {
    //[object setValue:@"n/a" forKey:attr];

    NSLog(@"%@:%@", attr, [self valueForKey:attr]);
}
NSLog(@"*************** end ***************\n");    

}

The Entity I have in this case is not Core Data and I can’t use attributesByName. But it should still be key-value compliant so I guess there is a way around this.

My Entity has 20+ properties and I would like to avoid doing it manual by listing each property and calling it by name in NSLog.

Thanks in advance for any help given:)

  • 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-16T18:26:13+00:00Added an answer on May 16, 2026 at 6:26 pm

    You can use the Objective-C runtime Api. The function class_copyPropertyList gives you all declared properties of a given class. You can then get their names etc using more runtime functions like property_getAttributes or property_getName. Using that name you can access the value in a KVC-compliant manner.

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

Sidebar

Related Questions

Imagine you have an entity that has some relations with other entities and you
I have the following two entities: @Entity class Relation{ @ManyToOne private User user; //some
I have some entities created with LINQ-to-SQL. Six of these entities (representing values primarily
I have created some JPA entities, and the table structure has changed a bit
I have some entities in my Data Warehouse: Person - with attributes personId, dateFrom,
I've got some entities which have decimal properties on them. These entities' properties are
I have a WPF DataGrid bound to some entities (Entity Framework 4+). User then
I have a project where i get some values over some entities and summing
Lets say I have some entities in the datastore that have blobkey properties that
I have some form values that include HTML entities, for example: <option value=Coup&#232;> Coup&#232;

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.