将 MKOverlay 保存到核心数据
我有一个应用程序可以跟踪用户并显示他们在何处使用 MKOverlay
。如何将此信息保存到 Core Data 中,以便当用户想要查看他们昨天去了哪里时,他们可以从 Core Data 加载地图/叠加层?
I have an application that tracks a user and shows where they've been using MKOverlay
. How can I save this information into Core Data so that when the user wants to see where they went yesterday they can load the map/overlay from Core Data?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我有一个类似的项目。我的是自行车道。以下是我构建核心数据模型的方式:
我使用订单参数,以便我可以计算出如何点连接起来。但我认为你现在可以检查关系的“有序”属性,尽管我不完全确定它是如何工作的。最小/最大属性用于更有效的搜索。在向我的 帖子。您可能会发现这也很有用。
您可能想向 Way 添加一些属性,例如
Date
。I have a similar project. Mine is for cycle paths. Here is how I structure my core data model:
I use an order parameter so I can work out how the points connect up. But i think you can just check the 'ordered' property of the relationship now although im not entirely sure how it works. The min / max attributes are for more efficient searches. I store the lat long values as integers to save space after a suggestion to one of my posts. You might find this useful too.
You probably want to add some attributes to the Way such as
Date
.您可以在核心数据模型中保存任何对象,但如果它们不是像 string、int 等默认类型,您将无法查询它们。
因此,您必须使用能够查询的属性来构造实体。
所以我看到两个选项,您将所有信息保存在一个实体中,但这样您将需要再次分配所有对象。
或者,您只需将查询和存档对象所需的属性保存在可转换属性或二进制数据属性中。
我不知道什么是最好的。
You can save any object in a core data model, but if they are not the default type like string, int, etc. you won't be able to query on them.
So you have to construct your entity with property that you will be able to query.
So I see 2 options, you save every information in an entity, but this way you will need to alloc again all objects.
Or you only save the property you will need to query and archive your object in a transformable or in a Binary Data property.
I don't know what would be best.