开发者

Getting Mac OS X version without using Carbon

开发者 https://www.devze.com 2022-12-09 13:38 出处:网络
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 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

精彩评论

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