iPhone:要存储相册图像 URL 并稍后进行比较:

发布于 2024-10-27 05:08:43 字数 884 浏览 0 评论 0原文

根据我从下面的链接查询,我已经实现了从 ALAsset 库检索相册图像。

将 ALAsset URL 图像上传到服务器

我得到的图像资源 URL 类似于以下, “资产库://asset/asset.JPG?id=1000000001&ext=JPG” “资产库://asset/asset.JPG?id=1000000002&ext=JPG” “assets-library://asset/asset.JPG?id=1000000003&ext=JPG”

我想将它们存储在数据库(或)文件中[我不知道哪个适合用于以后的比较]。下次(比如,30 分钟后),我想再次从 Asset 中获取所有图像 URL,并与存储在数据库中的先前图像 URL 进行比较,以查找相册中是否添加了任何新图像。如果相册中添加了任何新图像,那么我会在代码中获取该图像。

我想知道,我应该使用什么来存储图像 URL 字符串,是 SQLite 数据库(还是)文件,以及下次哪个应该足以比较以前的数据和当前的数据?我想创建 sqlite 数据库并存储数据,并将图像 URL 字符串与存储的数据进行比较,就像这样……。我觉得该走吗?如果是,我可以知道如何将数据(图像 URL 字符串)存储在 sqlite 数据库中,并在新图像 URL 和存储的数据之间进行比较吗? 我通过 Firefox sqlite 管理器插件创建了一个 sqlite 数据库并添加了一个表。我没有进一步获取任何示例来解决我的目的,即将图像 URL 字符串存储在 sqlite 数据库中,并在存储的图像 URL 字符串和我从资源库获得的新图像 URL 字符串之间进行比较。

请帮忙和指教。

谢谢你!

As per my query from the below link, i've implemented retrieving photo album images from ALAsset Library.

Upload ALAsset URL images to the server

I get the images Asset URL's like below,
"assets-library://asset/asset.JPG?id=1000000001&ext=JPG"
"assets-library://asset/asset.JPG?id=1000000002&ext=JPG"
"assets-library://asset/asset.JPG?id=1000000003&ext=JPG"

I want to store these in a database (or) file [I don't know which is suitable for comparison for later purposes]. Next time(say,after 30 mins), i want to get again all the image URL's from Asset and compare with the previous image URL's which has stored in a DB, to find if any new images has been added in photo album or not. If any new image is been added in photo album, then i get that image in my code.

I want to know, what should i use to store the image URL strings, whether SQLite database (or) file, and next time which one should be sufficient to compare the previous data and the current data? I thought of going with creating sqlite database and store the data and compare the image URL strings with the stored data like that …. Am i thinking right to go? If yes, may i know how to store the data(image URL strings) in a sqlite database and do comparison between new image URL's and stored data?
I created a sqlite database through Firefox sqlite manager plugin and added a table. I'm not getting any samples further to go through to solve my purposes, i.e. store the image URL strings in sqlite database and do comparison between the stored image URL strings and new image URL strings which i got from Asset library.

Please help and advise.

Thank you!

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

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

发布评论

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

评论(2

朦胧时间 2024-11-03 05:08:43

编辑..抱歉,我错过了解释你想要做什么的最后一条评论..

这里

http://developer.apple.com/library/ios/#documentation/DataManagement/Conceptual/iPhoneCoreData01/Introduction/Introduction.html

执行该教程以了解如何设置建立数据库和核心数据,您将看到它们如何保存信息 - 从那里只需更改代码以满足您的需求

再次编辑..之后您可以使用谓词来提取您需要的信息,和/或使用字符串比较( Google“iPhone sdk 比较字符串”)来与新字符串进行比较。

或者创建一个现有 URL 的数组并执行类似的操作

if ([myArrayOfURLS containsObject:theNewUrl]) {
       [self doSomethingWithMyNewURLIGuess];
}

Edit..sorry, i missed the last comment that explains what you want to do..

Here

http://developer.apple.com/library/ios/#documentation/DataManagement/Conceptual/iPhoneCoreData01/Introduction/Introduction.html

do that tutorial to learn how to set up the database and core data, you'll see how they save information - and from there just change code to suit your needs

Edit again.. after that you can use predicates to pull out info you need, and/or use string comparisons (Google "iPhone sdk compare strings") to compare to a new string.

or create an array of existing URL's and do something like

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