我需要根据 OS X 上安装的 Flash Player 版本采取不同的操作(由于 Flash 错误)。有没有办法以编程方式确定版本号?
顺便说一句,我正在为此使用 WebKit。
编辑:
我也试过
NSBundle* myBundle = [NSBundle bundleWithPath: @"/Library/Internet Plug-Ins/Flash Player.plugin/Contents/Info.plist"];
虽然路径名存在。 “myBundle”始终为零。
最佳答案
你只需要使用任何能让你在当前安装的插件的 CFBundleVersion
上的东西。像这样的东西在 shell 脚本环境中工作:
/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' /Library/Internet\ Plug-Ins/Flash\ Player.plugin/Contents/Info.plist
可能有一种方法可以在系统的已安装应用程序列表中搜索与 com.macromedia.Flash Player.plugin
匹配的 bundle ID,并从系统记录中提取 bundle 版本。
编辑:看起来 NSWorkspace
和 Launch Services 只是将项目映射到相关应用程序的 bundle ID,然后将映射一个 bundle URL 或 FSRef
的 ID。因此,最终,使用这种方法,您必须获取合适的包并从中提取版本。
可能还有一种方法可以从 web View 中运行的一些 JavaScript 代码中获取此信息。例如,Adobe 的 SWFObject
似乎使这很容易。有关更多信息,请参阅 "Detecting Flash Player versions and embedding SWF files with SWFObject 2" .
关于objective-c - OSX/Xcode/Objective-C : How to detect the version of Flash Player installed?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7392055/