开发者

Getting Mac OS X version without using Carbon

I need to get the 'nice' Mac OS X version string (e.g., "10.5.8"). Other sources say to use the "ge开发者_运维技巧stalt" to reliably get this value. The problem is, the Gestalt is a Carbon API and I can't link to Carbon (its a long story). Is there some other way, perhaps a direct Cocoa method?


How about

[[NSProcessInfo processInfo] operatingSystemVersionString]


You can run sw_vers in an NSTask and sort through its output.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜