Xcode 6 IB使用定义类名中断

Xcode 6 IB使用定义类名中断,xcode,class,interface,c-preprocessor,builder,Xcode,Class,Interface,C Preprocessor,Builder,我正在构建一个系统首选项窗格。为了避免名称冲突,Apple的方法是使用define更改类名,如下所示: #define SoundPref ComMycompanyPreferenceSoundPref #define AlertController ComMycompanyPreferenceSoundAlertController #define MicrophoneController ComMycompanyPreferenceSoundMicrophoneController 这里记

我正在构建一个系统首选项窗格。为了避免名称冲突,Apple的方法是使用define更改类名,如下所示:

#define SoundPref ComMycompanyPreferenceSoundPref
#define AlertController ComMycompanyPreferenceSoundAlertController
#define MicrophoneController ComMycompanyPreferenceSoundMicrophoneController
这里记录了这一点:

因此,我有一个头文件classnametransflation.h,它被添加到每个源文件的.h和.m中,其中包括:

#import "ClassNameTranslation.h"
这在Xcode 4和5中非常有效,但在Xcode 6中,IB看不到翻译后的名称。因此,如果我在IB中实例化一个对象并给它一个ComMycompanyPreferenceSoundPref类,它将看不到任何出口,也不会允许其他具有适当IBOutlet的对象连接到它

只有使用SoundPref类,IB才会感到高兴。当然,当我编译代码时,它会将SoundPref转换为ComMycompanyPreferenceSoundPref,但没有任何效果,因为IB中的对象没有使用ComMycompanyPreference类名前缀

我真的不想在我的源文件中使用像ComMycompanyPreferenceSoundPref这样可笑的长名称,Xcode 4和5使这成为可能


有人知道如何在Xcode 6中实现这一点吗?有人知道如何使用define或其他技术来实现这一点吗?

您的问题表明,使用define语句更改类的名称是个坏主意。即使有人提到苹果公司说这是可能的。这不是个好主意。Xcode具有长名称的自动完成。因此,在我看来,长名称并没有真正的问题。键入它并不是问题,因为自动补全工作得很好。问题实际上是阅读代码,当到处都是ComMycompanyPreference时,阅读代码是很困难的。如:[ComMycompanyPreferenceExternalProcessController sendRefreshAllNotification:self];与ComMyCompany不同的是,使用CMC。我猜IB会查找类似于@interface ClassName的代码,因此如果您只是将类声明更改为不使用宏,它可能会工作。似乎您也必须更改IBOutlet,以便IB允许连接。我真希望苹果没有打破这个。