Maybe I am too used to tackle cross-platform Objective-C. Whenever I am doing system detection now I do the following: uname() and dlsym(RTLD_DEFAULT, “UIApplicationMain”). This will reliably tell OS X (Darwin/NULL), iOS (Darwin/valid pointer), Linux+GNUstep (Linux/NULL) and Android+GNUstep(Linux/valid pointer) apart without making use of that variable that is not so reliable with GNUstep. Mapping kernel version back to OS version on iOS and OS X are trivial, as the rules of thumb: OS X 10.0 is NeXTSTEP 4, iOS 2.0 is Tiger.
On Oct 25, 2013, at 14:46, Greg Parker <gpar...@apple.com> wrote: > On Oct 24, 2013, at 10:36 PM, Maxthon Chan <xcvi...@me.com> wrote: >> Well I prefer uname() as it is 1) POSIX standard, cross-platform method > > If you're already working around an OS bug then it should be acceptable to > use OS-specific means to do so. > > >> 2) more fine grained as it tells minor versions apart. (e.g. I can tell >> Mavericks DP4 apart from Mavericks DP7 from Mavericks GM from App Store >> release of Mavericks from Mavericks 10.9.1) > > If you look at the documentation of NSFoundationVersionNumber and > NSAppKitVersionNumber you'll see that they change in almost every release. > uname() gives you a kernel version number, which similarly changes in almost > every release but is not guaranteed to do so. > > > -- > Greg Parker gpar...@apple.com Runtime Wrangler > >
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com