比如像这样的代码怎么写#if OS_VERSION > 4
   执行的代码....
#endif

解决方案 »

  1.   

     if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 5.0)⋯⋯
      

  2.   

    #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_5_0
        // This code will only compile on versions >= iOS 5.0
    #endif
      

  3.   

    // Obtain the list of proxies by running the autoconfiguration script
    #if !TARGET_OS_IPHONE || __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_2_2
    CFErrorRef err2 = NULL;
    NSArray *proxies = [(NSArray *)CFNetworkCopyProxiesForAutoConfigurationScript((CFStringRef)script,(CFURLRef)theURL, &err2) autorelease];
    if (err2) {
    return nil;
    }
    #else
    NSArray *proxies = [(NSArray *)CFNetworkCopyProxiesForAutoConfigurationScript((CFStringRef)script,(CFURLRef)theURL) autorelease];
    #endif
      

  4.   

    这里是关于iphone 设备信息的代码:
    http://blog.csdn.net/cxsjabcabc/article/details/7183021楼主说的应该是条件编译吧,那你需要用的是最大允许的版本等等宏