Question: Hi I am not sure what's wrong with pushing the new element to associative array of objects

```
var storeData3 = [  
{ 'key1' : 'value1' },  
{ 'key2' : 'value2' },  
{ 'key3' : 'value3' },  
{ 'key6' : null},  
{ 'key7' : ''},  
{ 'key8' : ""},  
{ 'key9' : null},  
{ 'key10' : 'value4'}
]; //as JSON object

var i=0;

storeData3=JSON.stringify(storeData3, function(key, value)
{if(!value)
{
    i++;

};

return value;
});

JSON.parse(storeData3);

function insert(name, number) 
{
    storeData3.push({name: number});        
}

if(i>0) insert('keyX','null');

```

The errors says "TypeError: storeData3.push is not a function".

Answer: 
```
// Download Image from Remote Server
NSURL *url = [NSURL URLWithString:@"Your IMAGE URL HERE"];
NSData *data = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"moon" ofType:@"jpg"]];

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
NSString *libPath = [paths objectAtIndex:0];
NSString *filePath = [libPath stringByAppendingPathComponent:[url lastPathComponent]];
BOOL status = [data writeToFile:filePath atomically:YES];
// Save Image file to Library Directory, if success then store infor about it in file
if(status)
{
    // If File Exist then read it otherwise creat new
    NSMutableDictionary *imageInfoDict;
    if([[NSFileManager defaultManager] fileExistsAtPath:[libPath stringByAppendingPathComponent:@"imageInfo.plist"]])
    {
        NSData *fileData = [NSData dataWithContentsOfFile:[libPath stringByAppendingPathComponent:@"imageInfo.plist"]];
        imageInfoDict = [NSMutableDictionary dictionaryWithDictionary:[NSKeyedUnarchiver unarchiveObjectWithData:fileData]];

        // To set As Background Load image from disc
        // Read filename from Dictionary, but you must know the key which you want to get
        NSString *fileName = imageInfoDict[@"68051_10151509108346729_1731694342_s.png"][@"imagePath"];
        // Set your image as background
        UIImage *image = [UIImage imageWithContentsOfFile:[libPath stringByAppendingPathComponent:fileName]];
    }
    else
        imageInfoDict = [NSMutableDictionary dictionaryWithCapacity:0];

    // Create Dictionary to store Single Image Info
    NSDictionary *imageInfo = [NSDictionary dictionaryWithObjectsAndKeys:[url lastPathComponent], @"imagePath",
                               [url lastPathComponent], @"imageName",
                               [NSDate date], @"date",nil];
    // Add Single Image Info to Main Dictionary
    [imageInfoDict setValue:imageInfo forKey:[url lastPathComponent]];

    // Convert Main info Dictionary to `NSData` to Save on Disc
    NSData *fileData = [NSKeyedArchiver archivedDataWithRootObject:imageInfoDict];
    // Save file to Disc
    [fileData writeToFile:[libPath stringByAppendingPathComponent:@"imageInfo.plist"] atomically:YES];

    // Read Info From File
    NSLog(@"%@",[NSDictionary dictionaryWithContentsOfFile:[libPath stringByAppendingPathComponent:@"imageInfo.plist"]]);
}

```
You should definitely use CoreData and app documents folder like this:

1. Download the data from the server: image and the other data
2. Save your image in the app documents folder with a generated name (if you don't already have the image name form the server)
3. Create a CoreData table (or multiple tables) depending on your needs and set there the image name, and the rest of the properties.
4 When you try to load the data, you can fetch data from the core data table and load the image from the documents directory.

I think this is the best and easiest way to do it if you are downloading the images just one time.

If you want to download different images or update images you could use the same process with the mention that you shouldn't save the images on the documents folder, you just have to use an AsyncImageDownload library (lots of them) to download the images and you have to store the image URL in your database.