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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:50:07+00:00 2026-06-17T16:50:07+00:00

Let me preface this question by saying that I believe it to be a

  • 0

Let me preface this question by saying that I believe it to be a memory management mistake on my end. I just can’t seem to figure out why it is happening.

I have a viewcontroller and a model class named Part.

#import <Foundation/Foundation.h>

@interface Part : NSObject

@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *partType;
@property (nonatomic, strong) NSString *description;
@property (nonatomic, strong) NSNumber *price;

- (id)initWithName:(NSString *)name AndType:(NSString *)type;

@end

In the view controller I have a property set as follows:

@property (nonatomic, strong) Part *part;

In the init function of ViewController I create some static arrays and create objects out of them:

- (id)init {
    self = [super init];

    self.partList = [[NSMutableArray alloc] init];

    NSArray *inputArray = @[@"Part1",
    @"Part2",
    @"Part3",
    @"Part4",
    @"Part5",
    @"Part6",
    @"Part7",
    @"Part8"];

    NSString *tempType = @"PartCategory";

    // Add dummy static data
    for (int i = 0; i < [inputArray count]; i++) {
        Part *partInput = [[Part alloc] initWithName:[inputArray objectAtIndex:i] AndType:tempType];
        //partInput.name = [inputArray objectAtIndex:i];
        //partInput.partType = tempType;
        NSLog(@"Inserting Part %@", partInput);
        [self.partList addObject:partInput];
    }

    return self;
}

The NSLog I call in that loop returns Inserting Part *nil description* for every part. I just can’t track down what is happening here.

EDIT: Here is the initWithName method from Part that the controller uses:

- (id)initWithName:(NSString *)name AndType:(NSString *)type {
    if(self = [super init]) {
        self.name = name;
        self.partType = type;
    }

    return self;
}
  • 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-17T16:50:08+00:00Added an answer on June 17, 2026 at 4:50 pm

    When using %@ to print NSObject, it calls debugDescription that by default calling the description method of that object and your Part object always have nil description.

    You better solve this by changing the description property name to something else, because it conflicts with the description method of NSObject.

    See also: NSObject description and debugDescription

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

Sidebar

Related Questions

Let me preface by saying that I saw this other question on the subject
First let me preface this question by saying that I'm fairly new to Javascript.
Let me preface this question with saying that I am very new to Orchard
Let me preface this by saying that I know that I can use HTML.Raw()
Ok, let me preface this by saying that I've read the following: Stackoverflow:how can
Let me preface this question by saying that I am a .NET developer at
First off, let me preface this question by saying that my professor is firmly
Let me preface this question by saying that I am relatively new to writing
Let me preface this by saying that I know the ContactCenter sample is just
Let me preface this question by saying I've exhausted Google, or at least 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.