2010-01-22 71 views
1

我正在開發一個與snow os不兼容的可可中的應用程序。是否可以在用戶嘗試在snow os中啓動應用程序時顯示警告消息?版本檢查在應用程序啓動之前cocoa

+0

呃,你真的意味着它是10.5和10.6不兼容?更常見的問題是如何指定它與10.6而不是10.5兼容。 – Ken 2010-01-22 10:31:35

+0

是的,我的應用程序與10.6不兼容,現在我需要在版本10.6中顯示警告消息。 – MobX 2010-01-22 10:40:20

+2

這和你以前的問題有何不同? http://stackoverflow.com/questions/2115373/os-version-checking-in-cocoa – 2010-01-22 12:13:05

回答

0

您需要將密鑰LSMinimumSystemVersion添加到您應用的Info.plist中。具體根據documentation

此字符串的形式必須是n.n.n 的,其中n是一個數。第一個數字 是 系統的主要版本號。第二個和第三個號碼 是次要版本號。例如,若要在以後支持Mac OS X v10.4和 ,請將此 密鑰的值設置爲「10.4.0」。

+0

我在提問者之前的問題上犯了同樣的錯誤。該應用程序在Leopard上運行良好,但由於某些未說明的原因,將不適用於Snow Leopard。 – 2010-01-22 22:47:55

3
#ifndef NSAppKitVersionNumber10_5 
#define NSAppKitVersionNumber10_5 949 
#endif 
if(NSAppKitVersionNumber>NSAppKitVersionNumber10_5) 
{ 
    NSAlert *alert = [NSAlert alertWithMessageText:@"Failed OS check" 
    defaultButton:NSLocalizedString(@"OK", @"") 
    alternateButton:nil otherButton:nil 
    informativeTextWithFormat: 
    @"I am a hard up developer that cannot afford to keep up with my 
    customers. If only they would buy more of my apps i could afford 
    maybe a new mac mini with Snow Leopard on it and bring my 
    App upto date. The problem is that unless i can bring my 
    app upto date i am not likely to get many customers at all. 
    If you know how that film with Art Garfunkel ended could 
    you please let me know."]; 
    [alert runModal]; 
} else { 
// start up app 
} 

*(感謝Adium的)

+0

啊,我看到你已經問過這個問題,它已經爲你回答了。 – 2010-01-22 12:37:52

相關問題