从 cocoa/objective c 前端使用 Python DAO
我的计划是开发一个多层、多平台的数据库应用程序。 我想使用来自 cocoa/objective c 应用程序、.net 应用程序和网络浏览器的数据。 我真的不知道从哪里开始,一直在寻找 Python,但找不到 cocoa/objective c 应用程序是否可以使用 python 数据对象。 谁能指出我如何实现目标的正确方向?
我的要求是:
- 数据层应该是平台无关的。
- 整个系统是可扩展的。因此多层。
- 数据访问可以来自 cocoa、.net 和基于 Web 的客户端。
My plan is to develop a multi-tier, multi-platform database application.
I would like to consume the data from cocoa/objective c apps, .net apps, and web browsers.
I don’t really know where to start and have been looking a Python, but can’t find if cocoa/objective c apps can consume python data objects.
Can anyone point me in the right direction as to how to achieve my goal?
My requirements are:
- Data layer should be platform independent.
- Whole system is scalable. Therefore multi tier.
- Data access can be from cocoa, .net and web based clients.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以让 python 和 Objective-C 一起工作。由于您可以使用 100% 普通 C,因此您可以使用 Python C 接口。但这非常乏味。
还有 PyObjC。它充当 Objective-C 和 Python 之间的桥梁。文档非常好,并且比直接使用 Python C 接口简单得多。
您也可以尝试使用 Thrift。 Thrift 类似于 Google 的 Protocol Buffers,但支持生成 Objective-C 类。您将必须编写一些样板代码来将数据对象转换为 Thrift 对象;但完成后,您可以在 thrift 支持的任何语言之间传递信息。文档比较薄弱;我不久前在 thrift wiki 这里写了一篇关于使用 Objective-C 的教程,不是确定它是否是最新的,因为从那时起已经发布了几个 thrift 版本。
You can make python and objective-c work together. Since you can use 100% normal C you can use the Python C interface. It's very tedious though.
There's also PyObjC. This acts as a bridge between Objective-C and Python. The documentation is pretty good and it will be much simpler than using the Python C interface directly.
You could also try using Thrift. Thrift is like Protocol Buffers by Google, but has support for generating Objective-C classes. You will have to write some boiler plate code to convert the data object into a thrift object; but after that is done you can pass information amongst any of the languages thrift supports. Documentation is on the thin side; I wrote a tutorial on using with Objective-C available on the thrift wiki here some time ago, not sure if it us up-to-date though as there have been several releases of thrift since then.