• 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
How do I store a float as a value in NSDictionary?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How do I store a float as a value in NSDictionary?


  • Subject: How do I store a float as a value in NSDictionary?
  • From: Koen van der Drift <email@hidden>
  • Date: Sun, 20 Jun 2004 08:08:22 -0400

Hi,

I am trying to make an NSDictionary with the following structure:

<key>@"key A"</key>
<value> myFloatA</value>
<key>@"key B"</key>
<value> myFloatB</value>


How do I put the float in the value field? I tried this:

[myDict setObject:[self floatA] forKey:@"key A"] but that gave this error:

incompatible type for argument 3 of indirect function call


I also tried the 10.3 only method:

[myDict setValue:[self floatA] forKey:@"key A"] but that gave the same error.


I understand that setObject should actually be passed an object, not a float or int, so should I convert the float to an object, say NSNumber? Or is there another solution?


thanks,

- Koen.
_______________________________________________
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: How do I store a float as a value in NSDictionary?
      • From: Christian Brunschen <email@hidden>
    • Re: How do I store a float as a value in NSDictionary?
      • From: Wade Tregaskis <email@hidden>
  • Prev by Date: Redirect stderr to NSTextView
  • Next by Date: Re: Redirect stderr to NSTextView
  • Previous by thread: Re: Redirect stderr to NSTextView
  • Next by thread: Re: How do I store a float as a value in NSDictionary?
  • Index(es):
    • Date
    • Thread