将图像下载到捆绑包中? [英] Downloading image into bundle?

查看:20
本文介绍了将图像下载到捆绑包中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 UIWebView 中显示文本和图像.内容并不总是相同的.我使用捆绑路径访问内容中的图像.对于内容的中间版本更新,我想允许用户下载新内容(文本和图像).这个新内容也将显示在 UIWebView 中.问题是我将不得不使用磁盘路径,而不是使用捆绑路径的常见模式.除非有办法在运行时将图像重新打包到包中.

I display text and images in a UIWebView. Content isn't always the same. I access images within the content using the bundle path. For an inbetween versions update of content, I'd like to allows users the ability to download new content (text & images). This new content will also display in a UIWebView. The problem is I will have to use a disk path rather than my common pattern of using the bundle path. Unless there is a way to repackage the image at runtime into the bundle.

一旦应用程序的下一次应用商店更新可用,之前下载的所有图像都将包含在应用程序包中.在此更新中,我将覆盖以前的内容并使用图像的捆绑路径.内容将完全相同减去图像路径.

Once the next app store update for the app is availble, all of the previously downloaded images will be in the app bundle. On this update, I'll write overwrite the previous content and use the bundle path for images. Content will be exactly the same minus the image path.

谁能提供一些关于这可能如何工作或更好的方法的见解?

Can anyone give some insight into how this might work or a better approach?

推荐答案

据我所知,一旦您的应用发布到 App Store,您就无法在 iPhone 上重新打包捆绑包.所以换一种方式,将包中的数据放在文件系统上,这样你就可以在运行时更改它.

So far as I know you cannot repackage the bundles on the iPhone once your app has been released to the App Store. So go the other way, and put the data from the bundle on the filesystem so you can change it at runtime.

我对这些东西的常用技巧是:

My usual technique for this stuff is:

  • 捆绑初始数据
  • 有一个例程在启动时检查 iPhone 文件系统上是否存在版本化文件
  • 如果该例程找不到文件的当前版本,将所有数据复制到 iPhone 的文件系统中
  • 在我的应用中引用来自文件系统的数据,而不是使用捆绑路径

所以,本质上你的包只是一个交付机制,一种用你需要的东西预加载文件系统的方法.一旦它在文件系统上,您可以更改任何您想要的内容.

So, essentially your bundle is just a delivery mechanism, a way to preload the filesystem with the stuff you are going to need. Once it's on the filesystem you can change anything you wish.

这篇关于将图像下载到捆绑包中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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