强制Cocoa应用程序以32位方式程序启动 [英] Forcing a Cocoa application to start in 32-bit mode programatically

查看:105
本文介绍了强制Cocoa应用程序以32位方式程序启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Cocoa应用程序,通常在支持此架构的任何Mac上以完全64位模式运行。

I have a Cocoa application that usually runs in full 64-bit mode on any Mac that supports this architecture.

现在我有一个外部API作为32位插件加载到主程序中。此API适用于第三方输入设备,只有小部分用户会购买,但这对于这个小百分比很重要。

Now I have an external API that is only available as a 32-bit plug-in to be loaded into the main program. This API is for a third-party input device that only a small percentage of my users will ever purchase, but that is important for that small percentage.

我的问题是如果在32位模式下执行,程序只能使用这个API。最简单的做法当然是:

My problem is that the program can only use this API if executed in 32-bit mode. The easiest thing to do is of course to:

场景1:要求用户在32位模式下启动程序,方法是通过Finder的获取信息对话框。

这很容易做到,但几乎不优雅..

This is easily done, but hardly elegant..

情况2:始终以32位模式运行,从而避免出现问题

很难说我想做什么...惩罚98%的用户

Hardly what I want to do either.. penalizing 98% of users for the sake of an exotic feature.

场景3:自动更改应用程序的启动属性,以便在下次启动时和每次启动时以32位模式启动之后

场景4:

方案3& 4有一个问题,很少记录如何做到这一点,它可能会让我陷入麻烦Mac App Store指南。

Scenarios 3 & 4 have the problem that very little is documented on how to do this and it might get me into trouble with the Mac App Store guidelines.

到目前为止,我已经建立:

So far, I've established:


  • 使用arch命令行工具将允许我以32位模式重新启动我的可执行文件

  • Finder脚本不会更改在32位模式下启动标志

  • 该标志由Launch Services API管理( http://blog.timac.org/?p=490

  • 但我没有找到任何界面以编程方式更改启动服务API中的标志

  • that using the "arch" command line tool will allow me to restart my executable in 32-bit mode
  • Finder scripting won't let me change the "Launch in 32-bit mode" flag
  • the flag is managed by the Launch Services API (http://blog.timac.org/?p=490)
  • BUT I haven't found any interface to programmatically change the flag in the Launch Services API

到目前为止,我只能看到这些选项,其中没有一个特别好:

So far I can see only these options, none of which seem particularly great:


  1. 使用NSTask和arch命令行工具重新启动应用程序

  2. 直接写入com.apple.LaunchServices.plist

  3. 将32位插件隔离为自己的32位插件,并使用IPC

解决方案1可能让我在MAS提交时遇到麻烦。解决方案2几乎肯定会在某些阶段做到这一点。只有解决方案3从用户的角度来说是完美的,但是增加了大量的复杂性以最小的支付。

Solution 1 could get me into trouble with the MAS submission. Solution 2 would almost certainly do so at some stage.. only solution 3 would be perfect from a user's perspective but add a huge amount of complexity for minimal pay-off.

推荐答案

选项5:
创建一个总是作为32位运行的可执行文件,它的唯一目的是驱动有问题的32位组件。从您的主应用程序启动该可执行文件,并使用某种类型的独立于处理器的io来彼此通信,可能是套接字。

Option 5: Create another executable that always runs as 32 bit and it's sole purpose is to drive the 32 bit component in question. Launch that executable from your primary application and use some type of processor independent io to communicate with each other, probably sockets.

这篇关于强制Cocoa应用程序以32位方式程序启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆