iOSDevSF
iOSDevSF

Reputation: 1179

didReceiveMemoryWarning app crashing

I am trying to write my didReceiveMemoryWarning method. Should I simply set my IBOutlets to nil like in my ViewDidUnload?

I am simulating a memory warning on the iPhone Simulator, but the second time I run it, the app crashes.

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}

- (void)viewDidUnload {

self.repCount=nil;
self.weight=nil;
self.repUp=nil;
self.repDown=nil;
self.weightUp=nil;
self.weightDown=nil;
self.next=nil;
self.weightLabel=nil;
self.titleLabel=nil;
self.repLabel=nil;

[super viewDidUnload];

}

Any help or direction is very much appreciated. Thanks

Upvotes: 0

Views: 1389

Answers (1)

Jonah
Jonah

Reputation: 17958

A UIViewController will unload its view in response to a memory warning if its view is not visible. Since you're not overriding the behavior of -didReceiveMemoryWarning you shouldn't need to do anything in that method. Just allow the view controller to behave normally.

Your app's crash is therefore due to some other problem and you have not provided enough information to determine what that might be.

Upvotes: 2

Related Questions