• 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: Converting a .strings text file to a NSArray or NSDictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
email@hidden
http://www.omnigroup.com/mailman/listinfo/webobjects-dev

 _______________________________________________
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

  • Follow-Ups:
    • Re: Converting a .strings text file to a NSArray or NSDictionary
      • From: Chuck Hill <email@hidden>
References: 
 >Converting a .strings text file to a NSArray or NSDictionary (From: Dev WO <email@hidden>)
 >Re: Converting a .strings text file to a NSArray or NSDictionary (From: Jan Grathwohl <email@hidden>)

  • Prev by Date: Re: Displaying Unicode encoded characters
  • Next by Date: Re: Help - Relationships, Bindings, w/Full Text Search
  • Previous by thread: Re: Converting a .strings text file to a NSArray or NSDictionary
  • Next by thread: Re: Converting a .strings text file to a NSArray or NSDictionary
  • Index(es):
    • Date
    • Thread