title: Saving ALAsset URL in NSUserDefaults
body: <p>Hi I have my <code>ALAsset URL</code> save in <code>NSMutableArray</code>, </p>
  
  <pre><code>"ALAsset - Type:Photo, URLs:assets-library://asset/asset.JPG?id=119A0D2D-C267-4B69-A200-59890B2B0FE5&amp;ex‌​t=JPG", 
  "ALAsset - Type:Photo, URLs:assets-library://asset/asset.JPG?id=92A7A24F-D54B-496E-B250-542BBE37BE8C&amp;ex‌​t=JPG", 
  "ALAsset - Type:Photo, URLs:assets-library://asset/asset.JPG?id=77AC7205-68E6-4062-B80C-FC288DF96F24&amp;ex‌​t=JPG
  </code></pre>
  
  <p>I wasnt able to save <code>NSMutableArray</code> in <code>NSUserDefaults</code> due to it having an error <code>Note that dictionaries and arrays in property lists must also contain only property values.</code>
                  Im thinking of using this :</p>
  
  <pre><code>            - (void)encodeWithCoder:(NSCoder *)encoder {
                  //Encode properties, other class variables, etc
                  [encoder encodeObject:self.selectedPhotos forKey:@"selectedPhotos"];
              }
  
              - (id)initWithCoder:(NSCoder *)decoder {
                  if((self = [super init])) {
                      //decode properties, other class vars
                      self.selectedPhotos = [decoder decodeObjectForKey:@"selectedPhotos"];
                  }
                  return self;
              }
  </code></pre>
  
  <p>then save and retrieve it with this code:</p>
  
  <pre><code>            - (void)saveCustomObject:(MyCustomObject *)obj {
                  NSData *myEncodedObject = [NSKeyedArchiver archivedDataWithRootObject:obj];
                  NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
                  [defaults setObject:myEncodedObject forKey:@"myEncodedObjectKey"];
              }
  
              - (MyCustomObject *)loadCustomObjectWithKey:(NSString *)key {
                  NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
                  NSData *myEncodedObject = [defaults objectForKey:key];
                  MyCustomObject *obj = (MyCustomObject *)[NSKeyedUnarchiver unarchiveObjectWithData: myEncodedObject];
                  return obj;
              }
  </code></pre>
  
  <p>But I somehow dont quite get it, still crashes in my code. Dont know how. And I wasnt able to save it in NSUserDefaults. Hope someone help. Really been having problem with this a while. Hope someone guide me on the right path of saving and retrieving it the right way from <code>NSUserDefaults</code>. Then back to a <code>NSMutableArray</code>.</p>