Objective-C - Adding items from NSDictionary to NSMutableDictionary

I'm having trouble trying to load objects from an NSDictionary to an NSMutableDictionary - code is as follows :

dictListData = [[NSMutableDictionary alloc] initWithCapacity:200];

...

NSError *jsonError = nil;
NSDictionary *jsonResultDict = [NSJSONSerialization JSONObjectWithData:[httpRequestCopy responseData] options:kNilOptions error:&jsonError];
NSDictionary *tempDataset = [[jsonResultDict objectForKey:@"result"] objectAtIndex:0]; 

NSLog(@"tempDataset = %@", tempDataset);

[dictListData addEntriesFromDictionary:tempDataset];   // <-- Error here

The NSLog command outputs the data in a dictionary style format so I know the data is there, but the addEntriesFromDictionary command fails with the error :

'NSInvalidArgumentException' [NSMutableDictionary addEntriesFromDictionary:]: dictionary argument is not an NSDictionary'.

I've tried typecasting the tempDataset but made no difference. Any ideas?

I'm using Xcode 4.3.2, targeting iOS SDK 5.1, ARC enabled.

jsonResultDict = {
    result =     (
                (
                        {
                stCode = 000477065;
                stDesc1 = "TIMER KNOB";
                stQtyFree = 0;
                stQtyInStock = 0;
            },
                        {
                stCode = 0010311;
                stDesc1 = "DBLE TAPER CHUCK CAP";
                stQtyFree = 10;
                stQtyInStock = 10;
            },
                        {
                stCode = "0016-103";
                stDesc1 = "1/8 I.D";
                stQtyFree = 0;
                stQtyInStock = 0;
            },
                        {
                stCode = "0016-104";
                stDesc1 = "1/4 I.D";
                stQtyFree = 0;
                stQtyInStock = 0;
            },
                        {
                stCode = "0016-157";
                stDesc1 = "1/8 x 1/16 X 1/8 TEE";
                stQtyFree = 0;
                stQtyInStock = 0;
            }
        )
    );
}

Answers


It seems that tempDataset is an NSArray class.


Need Your Help

How do I use a (generic) vector in go?

vector go

I am using a Vector type to store arrays of bytes (variable sizes)

How to add quantity option to each product item in the category list page?

magento magento-1.8

How can I add quantity option to each product item in the category list page?