4

I want to define a macro globally. I want to override NSLocalizedString() throughout my whole project. Is that possible and how do I do it?

2 Answers 2

18

Declare the macro in the #ifdef __OBJC__ section of your AppName-Prefix.pch.

Sign up to request clarification or add additional context in comments.

2 Comments

But be careful about "renaming" a common class, etc. Such things can bite you in unexpected ways.
Thx. I'll override NSLocalizedString to call the very same function. I'll just change the Bundle it will be called on since i'm trying to achieve in-app localization (switching languages on-the-fly within the app). You still think this could cause problems? Anyways I'm alarmed :)
5

You define your macro in some header file. You place this header file in *.pch file (prefix header file). Search for "prefix" in build settings for your target. Make sure your *.pch file is used.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.