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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:21:06+00:00 2026-06-05T07:21:06+00:00

Trying to write a custom description method for my NSManagedObject subclass and it instead

  • 0

Trying to write a custom description method for my NSManagedObject subclass and it instead of print that data in self.myvarname it prints out “Myvarname” or printing self.userCount it prints “UserCount”?

Followed this example: http://brandontreb.com/objective-c-tutorial-helpful-debugging-by-overriding-the-description-method/

Also, why in the xcode console when I type “po myroominstance.name” or “po myroominstance.usage” does it say no property found (given the class below)?

Here is my class:

.h
===================
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>


@interface Rooms : NSManagedObject
{
  NSString *name;
  NSNumber *capacity;
  NSString *descr;
  NSString *usage;
}

@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSNumber * capacity;
@property (nonatomic, retain) NSString * descr;
@property (nonatomic, retain) NSString * usage;

@end


.M
==================
#import "Rooms.h"

@implementation Rooms

@dynamic name;
@dynamic capacity;
@dynamic descr;
@dynamic usage;

-(NSString *) description 
{
    return [NSString stringWithFormat:@"ID: %@ Name: %@ Website: %n",
        usage  ,descr,name];
}

@end

UPDATE 1:=========================================================

====== My break point is on this line ==========
Room *myRoom = [Room findFirst];
NSLog(@"The room name is %@", myRoom.name);
================================================

If I break at the NSlog line above, which by the way prints out “The room name is Name” and then type, in the console, “po myRoom.name” I get “Name”. If I type “po myRoom.descr” I get “Descr”.

  • 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-06-05T07:21:08+00:00Added an answer on June 5, 2026 at 7:21 am

    Neither of the others get the formatting quite correct, but they’re barking up the wrong tree, anyway. You seem to have copied the -description method from the tutorial you linked to and not adjusted it to match your class.

    You could implement it like so:

    - (NSString*) description
    {
        return [NSString stringWithFormat:@"<%@ %p> name %@, capacity %@, descr %@, usage %@", [self class], self, name, capacity, descr, usage];
    }
    

    (There’s no need to invoke -intValue on capacity and then use the “%d” formatting specifier.)

    However, that doesn’t explain why you’re not getting the results you expect during a debugging session or when asking for the description of one of your instances. Please edit your question and add the specifics of how you’re asking for the description and what exactly you’re getting. For example, are you logging your instances in code? If so, show the logging statements and the output. Are you using po in the debugger? If so, show the actual command and the output.

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

Sidebar

Related Questions

I'm trying to write a custom filter method that takes an arbitrary number of
I am trying to write a custom script that will keep a list of
I'm trying to write a custom JSPX tag that reads the value of a
I'm trying to write a custom method security interceptor. However, it isn't using the
I'm trying to write a custom MarkupExtension that allows me to use my own
I'm trying to write a custom SQL query that will create a list of
I'm trying to write a custom validation class that validates that an email is
I'm trying to write a custom search that will search all categories and individual
I'm new to Matlab and I'm trying to write custom function in matlab that
I know that if I write a class, I can definite a custom print

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.