在 iPhone 上存储静态内容?
我想知道为我的应用程序存储静态内容的最佳方式是什么。 例如产品列表(名称、照片、价格、网址)。
也许这样可以直接找到一个好的教程吗?
I was wondering what is the best way to store static content for my app.
E.g. a list of products (name, photos, price, url).
Maybe s.o. can direct to a good tutorial?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为 Core Data 是最好的方法,你应该使用它。
这是 Apple 文档的链接(教程 )
Jeff Lamarche 的博客中也有一个很好的讨论 帖子
一个值得检查的好东西是 Jeff 的书“更多 iPhone 3 开发”。
I think Core Data is the best way , and you should use that.
Here's a link to Apple's Docs ( tutorial )
Also theres a good discussion in Jeff Lamarche's blog in this post
A good thing to check for, would be Jeff's book "More iPhone 3 Development".
您可以将所有内容存储在 SQLite 数据库文件中,该文件将作为应用程序中的资源提供。但当然最好让 Core Data 为您读取该文件。
You can store everything in a SQLite database file which would be provided as a resource in your app. But it is of course better to let Core Data read that file for you.
我认为 Core Data 和 SQLite 对于你想要的东西来说都太重了。除非您有大量产品列表,否则您应该将它们存储在 plist 中。设置最少,并且访问它比任何其他解决方案都容易得多。它非常适合少量静态信息,并且非常易于以后编辑。
以下是使用 plist 的教程:
http://humblecoder .blogspot.com/2009/05/iphone-tutorial-storing-and-retriving.html
I think both Core Data and SQLite are too heavy duty for what you want. Unless you have a large list of products, you should store them in a plist. The setup is minimal and accessing it is far easier than any of the other solutions. It's ideal for a small amount of static information and very easy to edit later.
Here's a tutorial on using plists:
http://humblecoder.blogspot.com/2009/05/iphone-tutorial-storing-and-retrieving.html