Search code examples
objective-cpreprocessorbitcode

Will the macros __FILE__, __LINE__ and __PRETTY_FUNCTION__ work irrespective of the build type?


I want to use the Objective-C macros __LINE__ and __PRETTY_FUNCTION__ to log some information at runtime. There are many tools that can provide details to crash dumps, but in my case I want to analyse remote database entries, e.g. record which method made the entry and which operating system (Android or iOS).

I am not familiar with the macros __LINE__ and __PRETTY_FUNCTION__ and although they are working for my current build configuration (non-App Store), I am not sure if it will keep on working when the build configuration changes.

Will the information persist when making builds differently, such as a Release build that does not have debug symbols included?

And do App Store builds using bitcode have an influence on this?


Solution

  • These macros are replaced during preprocessing with the real values, before compilation.

    I am not sure if it's a good idea to use them in production but they will definitely work. They don't need debug symbols (they are part of the source code) and they don't care how you sign the application package.