Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 909363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:51:56+00:00 2026-05-15T16:51:56+00:00

I had not run into this before but I wanted to know if it’s

  • 0

I had not run into this before but I wanted to know if it’s possible to store KEYS with special characters in Objective-C / Cocoa Touch

Since one can force a line break in a NSString with \n I wanted to store some values in a plist (and they do need to be the keys). It’s just about 20 lines to static data (well, the keys, the values are NSNumbers that get saved to a file) for which I don’t want to use sqlite, so it’s either a dictionary or a static array that I can save to disk.

Here is the .plist
alt text http://www.davidhomes.net/plist.png

So when I try to set a value for any key without special characters all is fine. But trying to set for, say, ‘Leg Width\n or Height’ returns

 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFDictionary setObject:forKey:]: attempt to insert nil key'

being the argument a NSString = @”Leg Width\n or Height”

Any help is appreciated

Best regards
david

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T16:51:57+00:00Added an answer on May 15, 2026 at 4:51 pm

    The string in the plist editor is the unescaped string. So, I often prefer to keep regular expressions in the plist file, using the plist editor.

    So, for the entry Leg Width\n or Height, the key to be used is

        [dict objectForKey:@"Leg Width\\n or Height"]
    

    Note that you put a literal backslash in the plist entry.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this isn't a unique issue but I've not had much luck finding
I've been working at this for two days and have not had much luck.
Possible Duplicate: How to catch exceptions I have not really had to use try
Various incarnations of this question have been asked here before, but I thought I'd
I have run into a bit of a problem, well not sure if it
I have a Linode (Ubuntu 9.10, but upgrading not a problem) where I run
It is likely that this type of scenario is not possible as I have
I was just making a simple registration form but suddenly run into a weird
Feeling I had not enough control over the chart if I had used a
I am a C# developer. Still learning. I had not learn all the features

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.