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