• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: write dictionary to file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: write dictionary to file


  • Subject: RE: write dictionary to file
  • From: "ROSE,ROBERT W (HP-Corvallis,ex1)" <email@hidden>
  • Date: Tue, 8 Apr 2003 15:55:21 -0700

I've never used -[NSDictionary dictionaryWithObjectsAndKeys:], but it looks
like from the documentation that it's supposed to take a 'NULL' terminated
list of key/value pairs, not a 'nil' terminated list. It says: "If any key
is nil, an NSInvalidArgumentException is raised."

Try [NSDictionary dictionaryWithObjectsAndKeys: value, key, NULL ] instead?

http://developer.apple.com/techpubs/macosx/Cocoa/Reference/Foundation/ObjC_c
lassic/Classes/NSDictionary.html#CBHCIFDD

-robert rose
hp

-----Original Message-----
From: Gerriet M. Denkmann [mailto:email@hidden]
Sent: Tuesday, April 08, 2003 1:36 PM
To: email@hidden
Subject: write dictionary to file

When I run this small program:

id key = [ NSNumber numberWithInt: 42 ] ;
id value = @"the meaning of life" ;
id totalKnowledge = [ NSDictionary dictionaryWithObjectsAndKeys: value,
key, nil ] ;
if ( ![ totalKnowledge writeToFile: @"/tmp/abc.plist" atomically: YES ]
)
NSLog(@"confused");

I always get "confused".
I read the docs over and over again, but do not see anything wrong.
Is this a bug, or have I missed something?

Btw: it work of course with key = @"42".

Gerriet.
_______________________________________________
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.
_______________________________________________
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.

  • Prev by Date: Re: NSTableView and crashes, what am I doing wrong?
  • Next by Date: Re: NSTableView and crashes, what am I doing wrong?
  • Previous by thread: Re: write dictionary to file
  • Next by thread: Re: write dictionary to file
  • Index(es):
    • Date
    • Thread