How can I log the current line via NSLog in Cocoa / Objective C?

Is it possible to log the current line number using NSLog in Cocoa / Objective C?

This is what I thought I should do:

NSLog(@"current line: %@ and value: %@",__LINE__,abc);

And I'm getting Thread 1: Program Received Signal: "EXC_BAD_ACCESS"

Answers


The __LINE__ macro provides an integer so you need to change your format string. Instead of %@ you need a %d.

NSLog(@"current line: %d",__LINE__);

Need Your Help

Can I launch app which is installed on iPhone using appium without providing .app path

ios ios-ui-automation appium

I want to launch an already installed app on iPhone/iOS simulator without providing .app or .zip path. Since I do not have those files with me now. Is it possible? Can I launch by just providing bu...

Save data to localStorage when form is submitted

forms submit local-storage

Is it possible to save data from form to localStorage AND submit the form? I need to submit the form but it would be important to save the values to localStorage also. How can I do this?

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.