Re: Converting a .strings text file to a NSArray or NSDictionary
Re: Converting a .strings text file to a NSArray or NSDictionary
- Subject: Re: Converting a .strings text file to a NSArray or NSDictionary
- From: Dev WO <email@hidden>
- Date: Wed, 27 Sep 2006 14:20:59 +0200
Hello Jan, thanks for the pointer. I did: NSDictionary dict = (NSDictionary)NSPropertyListSerialization.propertyListFromString((rm.inputStreamForResourceNamed("text.strings", FrameworkName, null)).toString());
but got to the following crash: ----------- A fatal exception occurred: propertyListFromString parsed an object, but there's still more text in the string. A plist should contain only one top-level object. ---------- I checked to see if there's any commentaries in the string file that could lead to something like that... but nothing.
I might have done something wrong...
Xavier
Hi Xavier,
you could read the content of your InputStream into a String and then use NSPropertyListSerialization to parse that String into a dictionary:
NSDictionary dict = (NSDictionary)NSPropertyListSerialization.propertyListFromString(fileContent);
Jan
Am 26.09.2006 um 12:06 schrieb Dev WO:
Hi:)
I've got a resource in my Framework (text.strings), I know I can access a specific key using WOResourceManager.stringForKey, but I need to create an array of all the key in the file.
I first though I could go through an InputStream like rm.inputStreamForResourceNamed ("text.strings", FrameworkName, null))
but I'm not sure what to do next...
I think I'm probably not going the easiest way. Maybe WOResourceManager already has a feature to get all the key-value in a NSArray or NSDictionary, but I can't find it.
Any pointer is greatly appreciated.
Thanks
Xavier_______________________________________________ WebObjects-dev mailing list
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden