I have a method in which I save a userdefault in viewWillAppear like so:
self.getUserName = [defineXMLData objectForKey:@"fromUserName"];
NSLog(@"Saved Array %@" ,self.getUserName);
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
[prefs setObject:self.getUserName forKey:@"voucherFromUserName"];
[prefs synchronize];
I do get data from the array in my NSLog but when I try load the user default into the array it returns null? I tried with another saved user default from another view controller and it works.
I try to load the nsarray in viewDidload like so:
self.voucherArray = [prefs arrayForKey:@"voucherFromUserName"];
Even if I try to use the original array in which I saved the data it still does not work:
self.voucherArray = self.getUserName;