在Cocoa应用程序的Xcode中使用MACOSX_部署_目标进行条件编译
在Cocoa应用程序中,我希望使用条件编译,如:在Cocoa应用程序的Xcode中使用MACOSX_部署_目标进行条件编译,cocoa,xcode,macos,conditional-compilation,Cocoa,Xcode,Macos,Conditional Compilation,在Cocoa应用程序中,我希望使用条件编译,如: #if MACOSX_DEPLOYMENT_TARGET <= MAC_OS_X_VERSION_10_4 [[NSFileManager defaultManager] removeFileAtPath:path handler:nil]; #else [[NSFileManager defaultManager] removeItemAtPath:path error:NULL]; #endif #如果MACO
#if MACOSX_DEPLOYMENT_TARGET <= MAC_OS_X_VERSION_10_4
[[NSFileManager defaultManager] removeFileAtPath:path handler:nil];
#else
[[NSFileManager defaultManager] removeItemAtPath:path error:NULL];
#endif
#如果MACOSX_部署_目标MACOSX_部署_目标
主要用于执行弱链接。您应该使用MAC\u OS\u X\u VERSION\u MIN\u REQUIRED
来执行条件编译:
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
[[NSFileManager defaultManager] removeFileAtPath:path handler:nil];
#else
[[NSFileManager defaultManager] removeItemAtPath:path error:NULL];
#endif
#如果需要MAC_OS_X_VERSION_MIN_
如需更多示例,请参阅Apple。完美!非常感谢你。