将数据存储与 Mapkit 相结合

发布于 2024-08-17 01:16:11 字数 251 浏览 4 评论 0原文

有人对使用带有mapkit的数据存储来提供可按位置查询的位置(餐厅)数据库有任何建议吗?

我想使用核心数据,但将信息导入其中似乎本身就是一个项目。如果有人对将现有 sqlite/cvs 文件转换为 coredata sqlite 文件有好的建议,我们将不胜感激。

老式的 sqlite 是否比使用核心数据更好,或者我是否应该为该工作创建一个 Web 服务?

我希望能够根据地图缩放来查询位置。

如果您对此事有任何建议,谢谢。

Does anyone have any advice on using a datastore with mapkit to provide a database of locations (Restaurants) that are query-able by location?

I would like to use Core data but importing the information into it seems like a project in itself. If anyone has good advice on converting an existing sqlite/cvs file to a coredata sqlite file that would be appreciated.

Is old-fashioned sqlite better than using core data for the task, or is it a case that I should create a web service for the job?

I would like to be able to query the locations based on the map zoom also.

Thanks if you have any advice on the matter.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陌路黄昏 2024-08-24 01:16:11

如果您正确编写了对象模型,您只需将其指向现有的 sqLite 数据库,它就会读取它,就像核心数据首先生成它一样。

例如,假设您有一个现有的sqlite数据库,其中包含诸如firstName,lastName,phone#等列。您只需创建一个核心数据模型,其中包含具有firstName,lastName,phone#等属性的实体将它们拼写相同并确保它们具有正确的类型,然后将 NSPercientStoreCoordinator 指向现有数据库。它会很好地阅读它。

核心数据始终是任何大型数据管理任务的最佳选择。一旦你学会了它,一切都会变得更加容易。


Edit01:

别介意以上。我正在考虑企业对象。核心数据不会轻易导入大多数现有的 SQL。

相反,我会将 sqlite 导出到 csv,然后使用类似 cCSVParse 转换为 plist。然后,您可以轻松地将其读入数组或字典,并使用它来填充核心数据数据库。

对于不依赖复杂关系的数据库来说,这将很容易工作。我认为拥有核心数据的未来好处最终将轻松抵消转换所花费的几个工时。

If you write your object model correctly, you can just point it at an existing sqLite database and it will read it as if core data generated it in the first place.

For example, suppose you have an existing sqlite db of people with columns like firstName, lastName, phone# etc. You just create a core data model with a entity with attributes of firstName, lastName, phone# etc. Spell them the same and make sure they have the right type and then point the NSPersistentStoreCoordinator at the existing database. It will read it in fine.

Core data is always the way to go for any larger data management task. It makes everything so much easier once you learn it.


Edit01:

Never mind the above. I was thinking of Enterprise Objects. Core data won't easily import most existing SQL.

Instead, I would export the sqlite to csv and then use something like cCSVParse to convert to plist. Then you can read it in easily to an array or dictionary and use that to populate the core data db.

That will work easily for db's that don't depend on complex relationships. I think the future benefits of having core data will eventually easily pay for the few man hours spent converting.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文