0

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
2

1 Answer 1

2
- (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?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.