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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:39:08+00:00 2026-05-18T11:39:08+00:00

I have generated this source code automatically the same way for all fields why

  • 0

I have generated this source code automatically the same way for all fields why compiler tells me Invalid Receiver type on NSUInteger and not NSString whereas created the same way:

/**
 class to represent an Person
 */
@interface Person: NSObject {
    // private members
    NSString* _firstName;
    NSString* _lastName;
    NSUInteger _age;
}
// Initializers
/**
 Initializes a new instance of the Person class.
 @returns a newly initialized object
 */
- (id)initPerson;

/**
 Initializes a new instance of the Person class with
 @param firstName The First Name
 @param lastName The Last Name
 @param age The Age
 @returns a newly initialized object
 */
- (id)initPersonWithFirstName:(NSString*)firstName LastName:(NSString*)lastName Age:(NSUInteger)age;

// public accessors
- (NSString*) firstName;
- (void) setFirstName: (NSString*)input;
- (NSString*) lastName;
- (void) setLastName: (NSString*)input;
- (NSUInteger) age;
- (void) setAge: (NSUInteger)input;
@end

@implementation Person
// Initializers
/**
 Initializes a new instance of the Person class.
 @returns a newly initialized object
 */
- (id)initPerson {
    if ( self = [super init] ) {
    }
    return self;
}

/**
 Initializes a new instance of the Person class with
 @param firstName The First Name
 @param lastName The Last Name
 @param age The Age
 @returns a newly initialized object
 */
- (id)initPersonWithFirstName:(NSString*)firstName LastName:(NSString*)lastName Age:(NSUInteger)age {
    if ( self = [super init] ) {
        [self setFirstName:firstName];
        [self setLastName:lastName];
        [self setAge:age];
    }
    return self;
}

// public accessors
- (NSString*) firstName {
    return _firstName;
}
- (void) setFirstName: (NSString*)input {
    [_firstName autorelease];
    _firstName = [input retain];
}
- (NSString*) lastName {
    return _lastName;
}
- (void) setLastName: (NSString*)input {
    [_lastName autorelease];
    _lastName = [input retain];
}
- (NSUInteger) age {
    return _age;
}
- (void) setAge: (NSUInteger)input {
    [_age autorelease];
    _age = [input retain];
}
@end
  • 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-18T11:39:09+00:00Added an answer on May 18, 2026 at 11:39 am

    NSUInteger is a numeric type, not an object. You can’t send messages to it and it doesn’t need memory management (unless you’re malloc-ing on the heap, which is a different process anyway and isn’t relevant here).

    If you actually want an object type to hold a numeric value – which you almost certainly don’t – use NSNumber. Otherwise, just treat it as you would an int or float. ie:

    - (void) setAge: (NSUInteger)input {
        _age = input;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All the generated webservice-stubs from our backend have an equals-method similar to this one:
I have a generated txt file. This file has certain lines that are superfluous,
I have a database file that is generated on a PC using Sqlite. This
I'm trying to have my Struts2 app redirect to a generated URL. In this
I have this php code, with which I am trying to generate a popup
I have an asp.net page with a button. This button generates and inserts a
This one's a tough one - I have a JFrame that generates JTextFields. When
I have a component which writes/generates javascript from a server side renderer. This component
I have a generated HTML page with flash content in it. I am trying
I have a PHP-generated page which is displaying some data about a set of

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.