Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.9k views
in Technique[技术] by (71.8m points)

xcode - Save image in asset catalog on runtime

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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
...