我应该在哪里放置我的全局宏?

Where should I place my global macros?

这样的调试宏应该放在什么地方,我想全局使用。

#define DEBUG_MODE

#ifdef DEBUG_MODE
#define DebugLog( s, ... ) NSLog( @"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )
#else
#define DebugLog( s, ... )
#endif

因为 prefix.pch 已在 Xcode 6.

中删除

仅创建一个 Constant.h 文件。

import view controllers, macroswhole application.

需要导入

像这样在 viewcontroller 中使用它:

#import "Constant.h"

如果您想在项目中使用宏,只需将它们添加到您项目的 "Build Settings" 下的 "Preprocessor Macro -> Debug" 中。

如果你想跨项目使用宏,你可以按照 Prince 的建议创建一个 Constant.h 文件。