iPhone app that stores large amounts of images

Asked 2 years ago, Updated 2 years ago, 93 views

I'm developing an app that stores a lot of images in the iPhone app, but it eats a lot of memory storage.
As a result, the operation will slow down or fall.

What should I be aware of when I store a large amount of images in the app?
Please give me some advice.

objective-c xcode iphone

2022-09-30 14:45

2 Answers

Try to initialize the object you used once and program it with the awareness that you don't store trash in your memory.


2022-09-30 14:45

When viewing

Use UICollectionView, UITableView, etc.
The resulting View is reused to reduce memory consumption.

When saving and retaining

Avoid leaving references to the data to be saved (NSData) and open immediately after saving the file.

Avoid keeping the entire data content in the instance.

Enclose the loop with @autoreleasepool when retrieving data or saving files in loop processing.

Other

There are more than a few things to be careful about, but it's also important to know where the problem is.

You can use the Profile tool included with Xcode to visualize memory usage.
Let's find out where memory consumption is actually increasing.

Don't mention memory leaks. Let's crush them.


2022-09-30 14:45

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.