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 6335635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:53:46+00:00 2026-05-24T18:53:46+00:00

I have two questions. The first question is regarding the dictionary datatype that is

  • 0

I have two questions. The first question is regarding the dictionary datatype that is used in a plist.

I have a few class methods that return specific floating point numbers. Rather than hardcode them in the code, I would like to put these in a plist in case they change. Here are a couple of the class methods:

+ (double) returnMinUsableFloatNumber
{
   return 0.005; 
}

+ (double) returnMaxUsableFloatNumber
{
   return 129.11
}

I created a plist and kept it using a dictionary where I created a couple of keys: “minNumber” and “maxNumber.” However, the only datatypes for the values are “Bool, Data, Date, Number, String.” The number is an integer and cuts off any of the decimal that is inputted. While it is entirely possible to just store as a string and convert to a double later, is it possible to store a double as a value in the plist dictionary to eliminate this step?

Also, how do I access this dictionary since these are class methods and cannot use a dictionary instance variable to initialize with the dictionary used in the plist.

Ex:

+ (double) returnMinUsableFloatNumber
{
   return \\ value returned from key "minNumber"
}
  • 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-24T18:53:47+00:00Added an answer on May 24, 2026 at 6:53 pm

    You need to store your NSNumber values in plist in <real> tag:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>MinUsableFloatNumber</key>
        <real>0.005</real>
        <key>MaxUsableFloatNumber</key>
        <real>129.11</real>
    </dict>
    </plist>
    

    Then you can read them by initializing NSDictionary with contents of your plist file. Your methods will look like this:

    + (double) returnMinUsableFloatNumber {
        NSDictictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:@"filename.plist"];
        return [[dict objectForKey:@"MinUsableFloatNumber"] doubleValue];
    }
    
    + (double) returnMaxUsableFloatNumber {
        NSDictictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:@"filename.plist"];
        return [[dict objectForKey:@"MaxUsableFloatNumber"] doubleValue];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two questions regarding to html table layout. First I will provide some
I have two questions regarding array: First one is regarding following code: int a[30];
I'm new to .NET and I have few simple questions regarding the GAC. First
Hey everyone, I want to start using Scheme and I have two questions. First,
I have two String.printable mysteries in the one question. First, in Python 2.6: >>>
I have two questions: 1) I have a few global variables for my website
I have two questions: (1) I learned somewhere that -O3 is not recommended with
This question is regarding wordpress . I have two variables $random_n and $adcount declared
I have two questions regarding jsTree: I am generating a jsTree using JSON with
I have a question regarding two types int -> (int -> int) and (int

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.