【发布时间】:2012-01-26 11:17:05
【问题描述】:
我的应用程序使用following code:
#if MAC_OS_X_VERSION_10_5 < MAC_OS_X_VERSION_MAX_ALLOWED
NSArray *globalPreferencePanes =
NSSearchPathForDirectoriesInDomains(NSPreferencePanesDirectory,
NSAllDomainsMask, YES);
#else
NSArray *globalPreferencePanes =
[NSArray arrayWithObjects:@"/Library/PreferencePanes",
[@"~/Library/PreferencePanes" stringByExpandingTildeInPath], nil];
#endif
return globalPreferencePanes;
我正在编译它的项目是针对 10.5 Mac OSX SDK,其中NSPreferencePanesDirectory 不存在(它仅存在于 10.6+ 中)。正因为如此,我有 #if 和 #else 来检查我们正在运行的 Mac OSX 版本,所以我知道我应该使用 NSPreferencePanesDirectory 还是手动给出首选项窗格的位置目录。
为了停止出现这种“使用未声明的标识符”错误,我应该进行哪些更改?
谢谢。
【问题讨论】:
标签: objective-c macos cocoa