开发者

Use XCode's ${PRODUCT_NAME} inside header files

I have a generic header file that I include in every project. Among other things, it defines a preprocessor macro for easily obtaining a reference to the app delegate. The problem is, the class name of the app delega开发者_开发问答te changes from project to project, as it includes the product name (AppDelegate). Therefore I wonder if it's somehow possible to use ${PRODUCT_NAME}, or a similar macro construct, in header files?


Set Preprocessor Macros in Xcode Build Settings.

APPDELEGATE_CLASS=$(PRODUCT_NAME)AppDelegate

In xcconfig,

GCC_PREPROCESSOR_DEFINITIONS = APPDELEGATE_CLASS=$(PRODUCT_NAME)AppDelegate

Then you can use APPDELEGATE_CLASS macro in your code.

@interface APPDELEGATE_CLASS : NSObject <UIApplicationDelegate> {
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜