title: How to add items to an NSMutableArray with NSUserDefaults
body: <p>I'm working on a game and it has 50 levels. I want to unlock each level after completing the level that comes before it. Right now I set up 50 <code>SKSpriteNodes</code>labeled 1 to 50 so they are numbered levels. I want the NSUserDefaults to tell the level-selection screen that the user has unlocked a new level when the level is complete. (i.e. if user completes level 2, unlock level 3).  I was trying to follow the solution on this question <a href="https://stackoverflow.com/questions/19634426/how-to-save-nsmutablearray-in-nsuserdefaults">How to save NSMutablearray in NSUserDefaults</a> but it wasn't working for me because I wasn't sure how to have an <code>NSMutableArray</code> that would be in both the level selection menu and the current level itself. </p>
  
  <p>This is the bit of code I had tried: </p>
  
  <pre><code>[[NSUserDefaults standardUserDefaults] setObject:levelAchieved forKey:@"level2"];
  [[NSUserDefaults standardUserDefaults] synchronize];
  </code></pre>
  
  <p>I used this when the user finished level 1</p>
  
  <p>Then I tried calling this: </p>
  
  <pre><code>NSMutableArray *levelAchieved = [[[NSUserDefaults standardUserDefaults] arrayForKey:@"level2"] mutableCopy];
  </code></pre>
  
  <p>To tell the level-selection scene that the user had achieved a new level and to unlock it on that scene. </p>
  
  <p>But this didn't work because I wasn't able to have the array in both the scenes, even when I made sure I imported the header file that had the <code>NSMutableArray *levelAchieved</code> in. </p>
  
  <p><strong>How can I properly add to the array, but furthermore --> Is this the right way to be approaching this type of thing? Is there a different way to unlock a series of levels between 2 scenes?</strong></p>