Cathy
Cathy

Reputation: 797

When didReceiveMemoryWarning and applicationDidReceiveMemoryWarning is called?

If both methods are implemented didReceiveMemoryWarning and applicationDidReceiveMemoryWarning which one will be called first, if the memory is low.

What is the difference between them?

Upvotes: 1

Views: 952

Answers (1)

Steven Kramer
Steven Kramer

Reputation: 8503

The difference is that they belong to different interfaces. One is for the application delegate, the other for uiviewcontroller. They should both try to release as much unneeded memory as possible.

I don't think the order is guaranteed anywhere, but it will probably be consistent. Set breakpoints or add log statements to measure which is called first.

Upvotes: 1

Related Questions