2009-12-05 55 views

回答

33

你需要,如果你想條件編譯使用宏:

#if __IPHONE_8_0 
// Works on >= version 8.0 
#else 
// Works on < version 8.0 
#endif 

或者,檢查在運行時,使用:

float ver = [[[UIDevice currentDevice] systemVersion] floatValue]; 
if (ver >= 8.0) { 
    // Only executes on version 8 or above. 
} 
+0

你肯定#ifdef來工作?我剛剛嘗試__IPHONE_8_0和7.0編譯的代碼,並導致崩潰。 – 2015-02-11 17:47:46

+0

沒問題..應該是'#if'和'#endif' – emotality 2015-08-28 18:07:35

相關問題