应用程序启动cocoa之前的版本检查

时间:2010-01-22 10:20:23

标签: cocoa

我正在使用与snow os不兼容的可可开发应用程序。当用户尝试在snow os中启动应用程序时,是否可以显示警告消息?

2 个答案:

答案 0 :(得分: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)

答案 1 :(得分:0)

您需要将密钥LSMinimumSystemVersion添加到您应用的Info.plist中。根据{{​​3}}:

  

此字符串的格式必须为n.n.n.   其中n是数字。第一个数字   是该版本的主要版本号   系统。第二和第三个数字   是次要修订号。对于   例如,支持Mac OS X v10.4和   稍后,您将设置此值   “10.4.0”的关键。