0

i am using NSKeyedArchiver to store a mutableArray after i click at the alertView button

case 1:
        [self.playlistsNames addObject:[[alertView textFieldAtIndex:0]text]];
        [NSKeyedArchiver archiveRootObject:self.playlistsNames toFile:fullPath]; 
        [self presentViewController:self.picker animated:YES completion:nil];
        break;

And in viewDidLoad i put this code

NSMutableArray *test = [NSKeyedUnarchiver unarchiveObjectWithFile:fullPath];
if (test) {
   NSLog(@"%d",test.count);
    self.playlistsNames = test;
    NSLog(@"%d",self.playlistsNames.count);
}

The problem is my tableView rows are the double of the count of the array. The tableView should show only these

Achats
Ajouts récents
Années 90
Les 25 plus écoutés
Meilleur classement
Morceaux récents
Test

But every time i add a playlist name it adds all of these and adds the name at last and the count of the array stils the same but the tableView shows the double like that

Achats
Ajouts récents
Années 90
Les 25 plus écoutés
Meilleur classement
Morceaux récents
Test
Achats
Ajouts récents
Années 90
Les 25 plus écoutés
Meilleur classement
Morceaux récents
Test
another one

and when i print the count of the array it only says 7. I really need your help and i home i was clear.

chandal
  • 67
  • 4

0 Answers0