When releasing an app for iPhone, if I disable NSLog(); will it perform better?
When releasing an app for iPhone, if I disable NSLog(); will it perform better?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One way to do it is to go into your Build settings and under the Debug configuration add a value to “Preprocessor Macros” value like:
Make sure you only do this for the Debug configuration and not for Beta or Release versions. Then in a common header file you can do something like:
Now instead of
NSLoguseDLogeverywhere. When testing and debugging, you’ll get debug messages. When you’re ready to release a beta or final release, all thoseDLoglines automatically become empty and nothing gets emitted. This way there’s no manual setting of variables or commenting ofNSLogsrequired. Picking your build target takes care of it.