Re: NSController Layer Problem
Re: NSController Layer Problem
- Subject: Re: NSController Layer Problem
- From: mmalcolm crawford <email@hidden>
- Date: Tue, 27 Apr 2004 12:31:45 -0700
On Apr 27, 2004, at 12:04 PM, Hasan Diwan wrote:
Data should be stored in PLIST format in the application defaults. At
the moment, I have tried adding an NSArrayController instance in my
class and using setContent to set the retrieved array from user
defaults. This crashes my program. I've also tried using an
NSUserDefaultsController, which yields "2004-04-27 12:00:32.469
FinanceX[2243] *** -[NSUserDefaults setObject:forKey:]: Attempt to
insert non-property value '<CFArray 0x34ac30 [0xa01900e0]>{type =
mutable-small, count = 1, values = (
0 : <Transaction: 0x318380>
)}' of class 'NSCFArray'" at runtime.
Umm, exactly as the error message says, you can't store non-property
values in user defaults.
<
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
ObjC_classic/Classes/NSUserDefaults.html>
"A defaults value can be only property list objects: NSData, NSString,
NSNumber, NSDate, NSArray, or NSDictionary."
The typical solution is to archive custom objects to an NSData object:
<
http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaBindings/Tasks/prefspane.html>
mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.