Save image in asset catalog on runtime

2019-02-23 07:42发布

问题:

I have to download new images from backend in background process and i need to save them for use later in the app.

In the other way, the original app images are in the asset catalog and when i add the new ones all images must accessed from the asset catalog.

I try to add images to directory's app but when i have to load any image the app do not know to discriminate between images in asset catalog and other, and i thing this is not the best solution for this

I do not know how add images to asset catalog on runtime or if i have to try other way to support this.

Any help i been so grateful

Many thanks!

回答1:

Asset catalog is a resource file/folder, that means this is placed inside your bundle.

All files inside your bundle means it is not writable. The files inside bundle has only read permissions.

You have to store in any one of the sandboxed folders (Documents, Library and temp)