How to define a macro globally in Objective-C?

2020-02-12 09:23发布

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条回答
仙女界的扛把子
2楼-- · 2020-02-12 09:56

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.

查看更多
成全新的幸福
3楼-- · 2020-02-12 10:00

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

查看更多
登录 后发表回答