Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

NSNick

macrumors regular
Original poster
Jun 27, 2008
162
0
Washington D.C.
What does this error mean


2008-07-13 18:25:21.027 RaiseMan[9684:10b] *** -[NSUserDefaults setObject:forKey:]: Attempt to insert non-property value '(
<Person: 0x18ecc0>
)' of class 'NSCFArray'.


in relation to this code


#import <Cocoa/Cocoa.h>

@interface MyDocument : NSDocument {
NSMutableArray *employees;
}
-(void)setEmployees:(NSMutableArray *)a;
@end



#import "MyDocument.h"


@implementation MyDocument

-(id)init
{
[super init];
employees = [[NSMutableArray alloc] init];
return self;
}

-(void)dealloc
{
[self setEmployees:nil];
[super dealloc];
}

-(void)setEmployees:(NSMutableArray *)a
{
if (a == employees)
return;

[a retain];
[employees release];
employees = a;
}

@end



#import <Foundation/Foundation.h>


@interface Person : NSObject {
NSString *personName;
float expectedRaise;
}

@property (readwrite, copy) NSString *personName;
@property (readwrite) float expectedRaise;
@end


#import "Person.h"


@implementation Person

-(id)init
{
[super init];
expectedRaise = 5.0;
personName = @"New Person";
return self;
}

-(void)dealloc
{
[personName release];
[super dealloc];
}

@synthesize personName;
@synthesize expectedRaise;
@end
 

Darkroom

Guest
Dec 15, 2006
2,445
0
Montréal, Canada
hey... i've noticed you're reading cocoa programming (3rd)... not sure if you know already, but there are solutions on their website (bignerdranch.com) that you can download and compare to your own code if you're having problems (although some of the solutions are not exactly as they are written in the book)... that being said, i still think it good practice to write the code out yourself following the book so you can get use to some of the syntax, etc..

also, you should use the "[ code ]" "[ /code ]" tags when you post code on this board... it makes it easier to read...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.