NSUser默认值和保存大小 [英] NSUserDefaults and saving size

查看:103
本文介绍了NSUser默认值和保存大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程式会在使用者开车时追踪他。它使用CLLocationManager和每次didUpdateToLocation被调用我保存CLLocation点。

I have an app that tracks a user as they drive along. It uses CLLocationManager and each time the didUpdateToLocation is called I save the CLLocation point.

约25英里的旅行产生了1200点左右的地方。

A trip of around 25 miles yields somewhere in the neighborhood of 1200 points.

这个数组的点对用户默认为测试。我应该看看CoreData正确保存这些信息吗?或者可能只是把一切写到一个文件?

As of now I save this array of points to the user defaults for testing. Should I look at CoreData to properly save this information? Or possible just write everything out to a file?

我担心的是NSUserDefaultsmax out?我可能有数百个保存的数组,每个都有成千上万的CLLocation点。

My concern is that can NSUserDefaults "max out"? I could potentially have hundreds of saved arrays, each with thousands of CLLocation points.

任何建议将非常感谢。

Any suggestions would be very much appreciated.

推荐答案

无论用户的大小是多少,都不是为了这个目的。顾名思义,它应该用于保存标志和变量以自定义或保存用户的会话细节。即使核心数据确实提供了一个优雅的解决方案,这是最有效的。如果你不想处理这个,你必须创建自己的文件,并保存在那里。这也很简单。但是我建议coredata如果你打算扩大的可能性,像多用户,不同的运行,大量的属性等等,因为它是一个真正的数据库像方法。

regardless of the size of users default, it is not meant for this purpose. As the name implies it should be used for saving flags and variables to customize or save session specifics of the user. Even though core data does offer an elegant solution for this and is the most efficient one. If you don't want to deal with this you would have to create your own file and save it there. Which is also pretty simple. However i suggest coredata if you plan on expanding the possibilities, like multiple user, different runs, lots of attributes etc etc since it is a real database like approach.

http://www.raywenderlich.com/934/core -data-on-ios-5-tutorial-getting-started

编辑:用户的默认大小没有限制。如果你通过苹果文档,你会看到它不是为了你描述的目的。

there's no limit to user's default size. Still if you go through apples documentation you will see how it is NOT meant for the purpose you describe.

http://www.iphonedevsdk.com/forum/iphone-sdk-development/38091-size-limitations -with-nsuserdefaults.html

这篇关于NSUser默认值和保存大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆