Objective-c ios将base64字符串保存到png文件

发布于 2024-11-24 18:32:27 字数 291 浏览 4 评论 0原文

因此,我正在使用一个 Web api,它返回表示 PNG 图像文件的 base64 字符串。

我必须(出于安全原因)将其保存到 SQLite。当需要图像时,我将读取图像并将其临时保存到文件系统中。

我的计划是将其作为 Base64 字符串保存在数据库中,然后在需要时抓取字符串 Base64 对其进行解码(以某种方式)并保存到文件系统。

关于我该如何解决这个问题有什么想法吗?我看过一些指南/帖子,但似乎仍然无法弄清楚。我知道 NSData 应该混合在一起,但我认为我做错了。

任何想法表示赞赏,谢谢:)

So i'm working with a web api that returns a base64 string representing a PNG image file.

I must (for security reasons) save this to SQLite. When the image is required I will then read the image and save it to the filesystem temporarily.

My plan is to keep it in the database as a Base64 string then when it's needed grab the string base64 decode it (somehow) and save to filesystem.

Any ideas on how I can go about this? I have looked at a few guides/posts and still can't seem to figure it out. I know NSData should be in the mix but I think i'm doing it wrong.

Any idea's appreciated, thanks :)

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

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

发布评论

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

评论(1

泼猴你往哪里跑 2024-12-01 18:32:27

对于 base64 的内容,您可能会在这里找到所需的内容:How do I do base64编码在 iphone-sdk 上?

For the base64 stuff you'll probably find what you need here: How do I do base64 encoding on iphone-sdk?

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