我可以使用 PyObjC 编写面向非越狱 iPhone 的 Python 应用程序吗?
目前是否可以为 iPhone 编译 Python 和 PyObjC,以便 AppStore 应用程序可以用 Python 编写?
如果不是,这是纯粹的技术问题还是苹果故意的政策决定?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
不:这是 Apple 故意的政策决定(无疑有一些技术基础),不支持 iPhone 上大多数语言的解释器/运行时 - Apple 希望您使用 ObjC(以及 Safari 中的 Javascript),而不是 Python、Java、Ruby、等等。
No: it's Apple's deliberate policy decision (no doubt with some technical underpinnings) to not support interpreters/runtimes on iPhone for most languages -- ObjC (and Javascript within Safari) is what Apple wants you to use, not Python, Java, Ruby, and so forth.
不,你不能使用 PyObjC 编写 iPhone 应用程序,原因很简单,PyObjC 根本不支持 iOS,而只针对 macOS。
No you cannot use PyObjC to write iPhone applications, for the simple reason that PyObjC does not support iOS at all but only targets macOS.
不,苹果严格禁止在 iPhone 上运行任何类型的解释器,这完全是政策问题。
no, apple strictly forbids running any kind of interpreter on iphone, and it is completely policy issue.
是的(大部分)。一个好方法是使用 Pythonista 及其 Xcode 模板。
这里建议禁止此类应用程序的其他答案是基于对“下载代码”的当时准确的禁令,但这从未得到一致执行,并且 它已经大约 7 年没有生效了。
这似乎有风险,因为 Pythonista 已经在应用商店中停滞了一段时间;然而,虽然 Pythonista Beta 目前已完整,但新版本“很快”即将推出,支持Python 3.10。
如果您需要在更频繁发布的应用程序中使用更新版本的 Python,但不需要 Xcode 模板在应用程序商店中分发您的应用程序,您可以查看 Pyto。
(大部分):它有自己的 FFI,但由于运行时的打包方式存在一些差异,所以与 PyObjC 不太一样。
Yes(mostly). A good way to do this is to use Pythonista and its Xcode template.
The other answers here suggesting that such apps are prohibited are based on an accurate-at-the-time ban on "downloading code", but this was never consistently enforced and it hasn't been in effect for about 7 years.
This might seem risky since Pythonista has been moribund on the app store for some time; however, while the Pythonista beta is currently full but a new version is coming "soon" that supports Python 3.10.
If you need a more recent version of Python in a more frequently-released app, but don't need the Xcode templates to distribute your app on the app store, you can check out Pyto.
(mostly): It has its own FFI that isn't quite PyObjC due to some differendes in the way the runtime is packaged.