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

Mapping XML to POJO using xstream

java xml xstream

I'm using XStream to map XML to the corresponding POJO. My XML structure is as below

Is it possible to create an HTML link or button that closes a full screen app running in mobile Safari?

javascript ipad html5 mobile-safari ipad-2

I am running an HTML5 (+ CSS3 and JavaScript) app in mobile Safari on the iPad. The following meta tag in my HTML file lets the app run full screen when started using an icon on the iPad's home scr...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.