0

I received data from a JSON web service and converted it to an NSArray. I've saved the NSArray in my database for retrieval at a later date. The data in the database looks like this:

(
        {
        ResponseCount = 2;
        ResponseTotal = 8;
    },
        {
        ResponseCount = 6;
        ResponseTotal = 8;
    }
)

Now I'm at the point where I want to take that data and turn it back into an NSArray. I try doing something along the lines of

NSArray *responseArray = self.CoreDataTable.ResponseArray; //NSString value

or

NSArray *responseArray = (NSArray *) self.CoreDataTable.ResponseArray; //NSString value

But when this runs, the NSArray comes back with no objects in it. Any ideas what is wrong?


Code to clarify data saving process.

CoreDataTable *coreDataTable = [NSEntityDescription insertNewObjectForEntityForName:@"CoreDataTable" inManagedObjectContext:self.managedObjectContext];
coreDataTable.CategoryName = [d objectForKey: @"CategoryName"];
coreDataTable.ResponseArray = [d objectForKey: @"ResponseArray"];
[self.managedObjectContext save:nil];
4

0 回答 0