Juan
Juan

Reputation: 627

ios adding array of dictionaries to another array of dictionaries

I'm trying to add the dictionaries I have in one array to another array with dictionaries so I can have one array with the dictionaries of both arrays.

I have tried this:

[arrayOne arrayByAddingObjectsFromArray:arrayTwo];

But I'm getting the following error:

-[__NSDictionaryM arrayByAddingObjectsFromArray:]: unrecognized selector sent to instance 0x75ba1a0

Upvotes: 0

Views: 715

Answers (1)

Guru
Guru

Reputation: 22042

- (NSArray *)arrayByAddingObjectsFromArray:(NSArray *)otherArray;

This function returns NSArray not NSDictionary, I guess in your code arrayOne is NSDictionary not NSArray right?

In Xcode source check warning shown for below line

[arrayOne arrayByAddingObjectsFromArray:arrayTwo];

To copy dictionary refer this: Copying the contents of an NSMutableDictionary into another NSMutableDictionary?

Upvotes: 2

Related Questions