I have a SOQL query that pulls back 3 records with data from 5 fields into my NSDictionary. One of the fields in Salesforce is numeric (currency) and is returned in the query as a double. When I insert the value from the NSDictionary into the textlabel.text I don't have any success, i.e., no value is instered. Is my syntax incorrect at the point of insertion? Should I be converting it to text?

cell.textLabel.text = [obj objectForKey: @"Sales_rev__c" ];


Have you tried using stringWithFormat to do the type conversion?

cell.textLabel.text = [NSString stringWithFormat:@"%f", [obj objectForKey: @"Sales_rev__c"]];
  • Thanks, I just tried that but the number value isn't returned, I just get 0.000000 returned instead (although on inspection at run time in the dictionary *obj there are two records that have a value greater than zero). I get the warning on the syntax: Format specifies type "double" but the argument has type "id". – Bartley Sep 11 '13 at 9:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.