• 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
[SOLVED] NSDictionary writeToFile without going to disk?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SOLVED] NSDictionary writeToFile without going to disk?


  • Subject: [SOLVED] NSDictionary writeToFile without going to disk?
  • From: Tito Ciuro <email@hidden>
  • Date: Sun, 19 Mar 2006 12:45:16 -0800

Hello,

I just wanted to summarize the solution:

// We start with a dictionary...
NSDictionary *someDictionary = ...

// We convert it to a string
NSString *plist = [someDictionary description];

// And now we convert it back to a dictionary
NSDictionary *newDict = [plist propertyList];

Thanks again for your help,

-- Tito


On 19/03/2006, at 10:54, Andy Lee wrote:

On Mar 19, 2006, at 1:41 PM, Tito Ciuro wrote:
Hum...: selector not recognized

Assuming it works, the problem is to recreate the dictionary with that string...

Poking around the docs, I see -propertyList is actually a method of NSString, not NSDictionary. You can send -description to an NSDictionary to get a string representation in property list format, and send -propertyList to the string to get back the original property list object, which in this case is a dictionary.


You could also use -[NSDictionary descriptionInStringsFileFormat] and -[NSString propertyListFromStringsFileFormat].

--Andy

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >NSDictionary writeToFile without going to disk? (From: Tito Ciuro <email@hidden>)
 >Re: NSDictionary writeToFile without going to disk? (From: Tito Ciuro <email@hidden>)
 >Re: NSDictionary writeToFile without going to disk? (From: "John C. Randolph" <email@hidden>)
 >Re: NSDictionary writeToFile without going to disk? (From: Tito Ciuro <email@hidden>)
 >Re: NSDictionary writeToFile without going to disk? (From: Andy Lee <email@hidden>)

  • Prev by Date: Re: CoreData : fundamental (or not) questions
  • Next by Date: Fwd: BiDirectional NSLevelIndicator
  • Previous by thread: Re: NSDictionary writeToFile without going to disk?
  • Next by thread: Re: NSDictionary writeToFile without going to disk?
  • Index(es):
    • Date
    • Thread