Console does not show me the right value while using NSLog to show a placeholder of an Array

I try to print the second placeholder of an Array in the console with the following code:

NSArray *europeTransaction = [[NSArray alloc] initWithObjects:europeDollarTransaction,  [NSNumber alloc] initWithDouble: 200.00], nil];    

NSLog(@"I'm displaying the second placeholders value in the NSArray %.2f", europeTransaction [1]);

The console shows me a value of 0.00, while it should give me a value of 200. What's wrong with the code?

Answers


The format specifier %f is used for floats, while you are passing an NSNumber instance. Either use the specifier %@ or ask the NSNumber for its float representation:

NSLog(@"I'm displaying the second placeholders value in the NSArray %.2f",
      [europeTransaction[1] floatValue]);

Need Your Help

XmlDocument.LoadXml() throws an exception of type ComException

c# .net xml windows-runtime

I'm trying to parse the xml document returned from this link but I get an exception of type ComException with the following message:

Improve js code to remove global variable and function

javascript jquery internet-explorer-8 refactoring

I have a piece of js code which I would really like to improve but not sure how.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.