How do I store a float as a value in NSDictionary?
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.