VAAA
VAAA

Reputation: 15049

How to download and update local images under monotouch app

I have a question regarding how to update local images embedded as content in the application.

My application is built using 30 images stored as "Content" (embedded in the app) for a image gallery that I have to show. Every 2 days the application check server info to see if the images have been changed in the database, in that case then I have to compare files and if any file has changed then I have to download it and update the local image.

I have read the the best way to store images for this kind of porposses is under "Library" folder of the application, but the images that comes with the app are built as "Content" (embedded)...

Any clue on the best way to do that in monotouch?

Thanks.

Upvotes: 2

Views: 261

Answers (2)

Rolf Bjarne Kvinge
Rolf Bjarne Kvinge

Reputation: 19345

You can't change any file from your app (they're read-only).

What you can do is to save the files to a read-write directory, and at runtime check if those images are there (and not then use the ones bundled with the app).

Upvotes: 0

poupou
poupou

Reputation: 43553

Resources, like images, that you bundle inside your .app becomes part of your application. Since the application is signed you cannot update (or remove) those files as it would invalidate the signature (there's also file permissions that won't allow this to happen).

note: it can work in the iOS simulator since it does not require (or check) for application signatures, however it won't works for application on devices.

What you can do is:

  1. Bundle default images with your applications;
  2. Download new images (when needed) and install them outside your application (in the appropriate directory);
  3. Have your application checks if there are downloaded images (or if images needs to be downloaded) and fallback to the images that ships with your application;

Upvotes: 3

Related Questions