OSX / Xcode / Objective-C:如何检测安装的 Flash Player 版本?
我需要根据 OS X 上安装的 Flash Player 版本采取不同的操作(由于 Flash bug)。有没有办法以编程方式确定版本号?
顺便说一句,我正在使用 WebKit。
编辑:
我也尝试过
NSBundle* myBundle = [NSBundle bundleWithPath: @"/Library/Internet Plug-Ins/Flash Player.plugin/Contents/Info.plist"];
,尽管路径名存在。 “myBundle”始终为零。
I need to take different action depending on the version of Flash Player installed on OS X (due to a Flash bug). Is there a way to programmatically ascertain the version number?
I am using WebKit for this, BTW.
EDIT:
I also tried
NSBundle* myBundle = [NSBundle bundleWithPath: @"/Library/Internet Plug-Ins/Flash Player.plugin/Contents/Info.plist"];
And although the pathname exists. "myBundle" is always nil.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您只需要使用任何能让您获得当前安装插件的 CFBundleVersion 的东西即可。类似的事情在 shell 脚本环境中有效:
可能有一种方法可以在系统的已安装应用程序列表中搜索与
com.macromedia.Flash Player.plugin
匹配的捆绑包 ID,并从中提取捆绑包版本系统记录也是如此。编辑:看起来
NSWorkspace
和 Launch Services 都只是将项目映射到相关应用程序的捆绑包 ID,然后将捆绑包 ID 映射到URL 或FSRef
。因此,最终,通过这种方法,您必须获取适当的捆绑包并从那里提取版本。可能还有一种方法可以从 Web 视图中运行的某些 JavaScript 代码获取此信息。例如,Adobe 的
SWFObject
似乎使这变得非常容易。有关详细信息,请参阅“检测 Flash Player 版本并使用 SWFObject 2 嵌入 SWF 文件”。You just need to use anything that will let you at the
CFBundleVersion
of the currently installed plugin. Something like this works in a shell scripting environment:There might be a way to search the system's list of installed applications for a bundle ID matching
com.macromedia.Flash Player.plugin
and pull out the bundle version from the system record, as well.EDIT: It looks like both
NSWorkspace
and Launch Services just map items to bundle IDs of relevant apps, and then will map a bundle ID to a URL orFSRef
. So ultimately, with this approach, you have to grab the appropriate bundle and pull out the version from there.There's likely also a way to get this information from some JavaScript code running within the webview. Adobe's
SWFObject
seems to make this quite easy, for example. For more, see "Detecting Flash Player versions and embedding SWF files with SWFObject 2".只需省略
Contents/Info.plist
部分即可;您需要获取捆绑包,而不是其 Info.plist:请记住,如果没有安装 Flash Player,请盖上外壳。
Just leave off the
Contents/Info.plist
part; you need to get the bundle, not its Info.plist:Remember to cover the case when there is no Flash Player installed.