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

  • Home
  • SEARCH
  • 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 8235699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:53:53+00:00 2026-06-07T18:53:53+00:00

I am working on some iOS code using Xcode 4.2.1, and I noticed that

  • 0

I am working on some iOS code using Xcode 4.2.1, and I noticed that when I parse thru a plist file and place everything in an NSDictionary, all the <string> values end up in an NSString, but all the <real>, <integer>, <true/> values end up in an NSNumber.

Is there a way to extract all the keys and values, but place each value in it’s matching data type?

So for example:

Put <string>Hi There</string> value in an NSString

Put <real>1.23</real> value in a float

Put <integer>4</integer> value in an NSInteger

Put <true/> or <false/> or <boolean>1</boolean> value in a BOOL

I have read thru a lot of posts and cannot find anything to help me do this. I am not even sure how to detemine what the wrapper element (terminology might be wrong) around a value even is!

NSDictionary only has NSString or NSNumber so this won’t work.

Will an NSArray/NSMutableArray hold each value’s data type independently, or will I need to add a third item (value data type) to store along with the key and value?

Maybe I am trying to redo something that has already been done?

EDIT: Here are more details on what I am trying to do…

What I want to do is read in a set of keys/values from XML file and then make those keys available as variables within the game (with the key being the variable name and the variable being set to the value associated with the key). The variable will be retrieved thru a method like myVar = [getVar @"name_of_key"];

EDIT: Here is how I am currently putting the XML into NSDictionary…

    NSDictionary *dictServer = nil;
    CFPropertyListRef plist =  CFPropertyListCreateFromXMLData(kCFAllocatorDefault, (CFDataRef)someXMLdata, kCFPropertyListImmutable, NULL);
    if ([(id)plist isKindOfClass:[NSDictionary class]]) {
        dictServer = [(NSDictionary *)plist autorelease];
    }
  • 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-06-07T18:53:55+00:00Added an answer on June 7, 2026 at 6:53 pm

    NSArray & NSDictionary require you to insert objects (such as NSNumber), not primitives (such as int). Is there a reason you need the original data types?

    UPDATE: NSNumber has class methods to wrap primitive values.

    aFloat = [NSNumber numberWithFloat:floatVar];
    aBool = [NSNumber numberWithBool:boolVar];
    

    To retrieve the values, you can use

    [aFloat floatValue]
    [aBool boolValue]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working some code that inserts csv rows into an SQLite database using Python.
I'm working on an iOS application that needs to play some sounds using the
I'm working on some project for iOS 5 using Xcode 4.2. I have one
I have some UIPopoverController that were working fine in 4.3/5.0 iOS iPad. Now, with
I'm working on a project that generates a iOS static library, and some sample
Working on some tweaks for a build script, I noticed that the output from
Working with some CoreText code on iOS and I am confused as to why
I'm working on some networking code for an iPhone application that interfaces with a
I have some code that moves bytes in a buffer using memmove() . The
Working on an iOS project that targets 4.0 and 5.0, using ARC. Running into

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.