I am developing an app with a view to take pictures.
I faced a very strange behavior lately, here is my code.
@interface ViewControllerPhotos : UIViewController
@property (strong) NSString* _albumID;
@end
@implementation ViewControllerPhotos
@synthesize _albumID;
- (void)didReceiveMemoryWarning
{
return;
// commented or not : give the same issue
// [super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self.navigationItem setHidesBackButton:YES];
self._albumID = [Tools generateUUID];
NSLog(@"new photoset : local UUID \"%@\"", self._photoSetLocalID);
}
@end
My issue is : if there is a memory warning, the UID stored in _albumID
is forgotten and regenerated so my album is broken in two. Why ? Should not the strong
keyword be able to keep the current value ?
Or is it because the viewDidload
is called again ? If it's the case then how to be sure we load our view for the first time for a proper init ? The methods sounded to be designed for it.