• 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: objectForKey crashes for string formats
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: objectForKey crashes for string formats


  • Subject: Re: objectForKey crashes for string formats
  • From: Chuck Soper <email@hidden>
  • Date: Thu, 22 May 2003 01:16:24 -0700

I believe that the @"string" directive creates an instance of NSConstantString.
I don't know why \r and %@ is causing a problem.

Shouldn't you use strings files for localization? Or do you have a special circumstance?
http://developer.apple.com/techpubs/macosx/Cocoa/TasksAndConcepts/ProgrammingTopics/Internationalization/Concepts/StringsFiles.html

Chuck


At 9:35 AM +0200 5/22/03, Lorenzo wrote:
Hi,
I use a NSDictionary to localize my software in different languages.
I have just discovered that if I try to get from a NSDictionary

theKey = @"Cannot save the file:\r%@";
foundString = [gLanguageStringsDict objectForKey:theKey];
my application crashes if the key is in the dictionary.


And if the key is only:
theKey = @"Cannot save the file:\r";
objectForKey returns nil even if the key is in the dictionary.


And if the key is:
theKey = @"Cannot save the file:";
objectForKey finds the key and returns the string properly.

So, cannot I really use those characters \r and %@ ?
Is it a NSDictionary's bug?
Is it my fault?


Best Regards
--
Lorenzo
email: email@hidden
_______________________________________________
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.

  • Follow-Ups:
    • Re: objectForKey crashes for string formats
      • From: Lorenzo <email@hidden>
References: 
 >objectForKey crashes for string formats (From: Lorenzo <email@hidden>)

  • Prev by Date: favicon.ico & drag types
  • Next by Date: What causes this error : MIG: server died : CGSExtractEventRecordsFromMessage
  • Previous by thread: objectForKey crashes for string formats
  • Next by thread: Re: objectForKey crashes for string formats
  • Index(es):
    • Date
    • Thread