简体   繁体   English

如何在OS X应用程序中存储/检索数据?

[英]How to store/retrieve data in OS X applications?

I am starting to develop my first Mac OS X application using Xcode. 我开始使用Xcode开发我的第一个Mac OS X应用程序。 My background is LAMP, so I typically store everything in a MySQL database. 我的背景是LAMP,因此通常将所有内容存储在MySQL数据库中。 What's the correspondent in OS X? OS X中的对应对象是什么?

My application will simply allow the user to enter new data, and then to retrieve it based on filters. 我的应用程序将仅允许用户输入新数据,然后基于过滤器进行检索。

I am not looking for specific code, but for some pointers as to how storing data into databases work in OS X. I have found very little resource on this subject. 我不是在寻找特定的代码,而是在寻找一些如何在OS X中将数据存储到数据库中的指针。我在这个主题上发现的资源很少。

SQLite is used in many situations where a database server isn't required. SQLite用于许多不需要数据库服务器的情况。 Apple uses it for things like their Mail app. 苹果将​​其用于诸如Mail应用之类的事情。 You can use some of the built-ins of Xcode (like sqlite.h) or a command-line shim of some kind. 您可以使用Xcode的某些内置功能(例如sqlite.h)或某种类型的命令行填充程序。 Other variants of SQL will require a separate download. SQL的其他变体将需要单独下载。

Core Data uses an object model which may be more convenient in a storage sense, though it has a moderate footprint and learning curve, and it's not cross-platform. 核心数据使用的对象模型在存储方面可能更方便,尽管它具有适度的占用空间和学习曲线,并且不是跨平台的。 Which may be important for the data migration that's common with database work. 对于数据库工作中常见的数据迁移,这可能很重要。

If you're just starting with desktop programming from a LAMP background, you could look into "wrapper" apps that let you package LAMP software on the desktop with a native GUI. 如果您只是从LAMP后台开始进行桌面编程,则可以查看“包装器”应用程序,这些应用程序允许您使用本地GUI将LAMP软件打包在桌面上。 Might be easier than going Objective-C from scratch since it's one of the more obtuse languages out there. 与从零开始使用Objective-C相比,它可能更容易,因为它是其中一种更晦涩的语言。 Xojo is also nice if you're used to VisualBasic and need to do cross-platform work. 如果您已经习惯了VisualBasic,并且需要进行跨平台工作,那么Xojo也很不错。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM