使用 Python 进行 iOS 编程

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14794724/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 12:27:28  来源:igfitidea点击:

Using Python for iOS programming

pythoniosobjective-cxcodenumpy

提问by Satyam Merja

I am developing and iOS app and would like to know if it is possible to use python scripts in Xcode to develop my app.

我正在开发 iOS 应用程序,想知道是否可以在 Xcode 中使用 python 脚本来开发我的应用程序。

I am comfortable with objective C and I am not aiming to create my entire app using python. Most of the code will still be in objective-C. The algo that I am using is very computationally intense; and so I thought using python (along with numpy and scipy) would speed things up.

我对目标 C 很满意,我的目标不是使用 python 创建我的整个应用程序。大多数代码仍将使用 Objective-C。我使用的算法计算量很大;所以我认为使用 python(以及 numpy 和 scipy)会加快速度。

I have heard that PyObjC 'may' be useful, but I have found threads on stackoverflow stating that PyObjC is not compatible with XCode 4.

我听说 PyObjC“可能”有用,但我发现 stackoverflow 上的线程指出 PyObjC 与 XCode 4 不兼容。

Also, is there any other better suited alternative to perform computationally heavy tasks in iOS.

此外,是否还有其他更适合的替代方案来在 iOS 中执行计算量大的任务。

Thank you for answering, in advance.

谢谢你的回答,提前。

回答by Sitses

I tried to install PyObjC and I finally got it running after five hours of reading stackoverflow and docs. For me this link worked like a charm: https://github.com/gregneagle/Xcode4CocoaPythonTemplates(without GUI, also see thisanswer). See this linkfor an example of using PyObjC with iOS.

我尝试安装 PyObjC,在阅读 stackoverflow 和文档五个小时后,我终于让它运行了。对我来说,这个链接就像一个魅力:https: //github.com/gregneagle/Xcode4CocoaPythonTemplates(没有 GUI,另见这个答案)。有关在 iOS 中使用 PyObjC 的示例,请参阅此链接