正在将图片下载到软件包中? [英] Downloading image into bundle?

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

问题描述

我在UIWebView中显示文字和图片。内容并不总是相同的。我使用束路径访问内容中的图像。对于中间版本的内容更新,我希望允许用户下载新内容(文字和图片)。这个新内容也将显示在UIWebView中。问题是我将使用磁盘路径,而不是我的常见模式使用束路径。除非有一种方法在运行时将映像重新打包到bundle中。



下载应用程式商店更新后,所有先前下载的图片都会显示在应用程式集中。在此更新中,我将覆盖以前的内容并使用映像的bundle路径。



任何人都可以深入了解这可能如何工作或更好的方法?


<解决方案

据我所知,一旦你的应用程序发布到App Store,你就不能在iPhone上重新打包。



我通常使用的方法是:




  • 捆绑初始数据

  • 有一个例程,用于检查iPhone上的版本文件是否存在文件系统启动时

  • 如果该例程找不到文件的当前版本,请将所有数据复制到iPhone的文件系统

  • 引用我应用程序中文件系统中的数据,而不是使用捆绑包路径



一个交付机制,一种方式来预加载文件系统与你需要的东西。一旦它在文件系统上,你可以更改任何你想要的。


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?

解决方案

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:

  • bundle up the initial data
  • have a routine that checks for the presence of a versioned file on the iPhone's filesystem at startup
  • if that routine doesn't find the current version of the file, copy all the data into the iPhone's filesystem
  • reference the data from the filesystem in my app, rather than using the bundle path

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天全站免登陆