开发者

version checking before application launch cocoa

I am developing an application in cocoa which is not compatible with snow os .Is it possible to show an alert message while开发者_运维技巧 user try to launch the application in snow os?


#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
}

*(thanks adium)


You need to add the key LSMinimumSystemVersion to your app's Info.plist. As per the documentation:

This string must be of the form n.n.n where n is a number. The first number is the major version number of the system. The second and third numbers are minor revision numbers. For example, to support Mac OS X v10.4 and later, you would set the value of this key to "10.4.0".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜