receiving collection element of type int is not an objective c object in iOS

Viewed 24024

I have the following dictionary:

NSDictionary* jsonDict = @{
                               @"firstName": txtFirstName.text,
                               @"lastName": txtLastName.text,
                               @"email": txtEmailAddress.text,
                               @"password": txtPassword.text,
                               @"imageUrl": imageUrl,
                               @"facebookId": [fbId integerValue],
                              };

In the last element, I need to use an integer, but I am receiving the error:

collection element of type int is not an objective c object

How can I use an int value in this element?

6 Answers

You have to use @(%value%) for non pointer datatype value store in Dictionary.

@"facebookId": @(fbId)
Related