0
votes

In this line of code:

NSInteger answer = 3; NSString *s = [NSString stringWithFormat:@"%ld",answer];

In Xcode 10.3, under a debug build there is no error. Under release builds I get this error:

values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead [-Werror,-Wformat]

I understand the why on the error, that I should also cast answer to (long), and the compiler will complain and fix the issue if I start with @"%d". But when the ld is there the compiler in debug builds keeps quiet, but in release it raises a flag.

Any ideas as to what setting would cause this to happen?

Thanks in advance!

1
Look at the build settings. there are lots of default differences. - Mojtaba Hosseini

1 Answers

0
votes

The answer to your question is pretty broad, but I think you should get an idea. Like the above comment there's a whole bunch of factors that filter the changes its going to take when building for debug and building for production release. For performance and compatibility apple is very strict on releases. Thus the default values for some of the build configs in the Build settings is pretty different from Building for debug and release.

Take a look at the images attached below:

enter image description here

enter image description here

Note : Most of them can be customized for your preference but it does effect the building process as well as the delivery!