Incompatible pointer to integer conversion 'int' with an expression of type 'id'

int, ios, nsdictionary

Solution

Try:

int categoriaID = [[categoriaDescription objectForKey:@"idCategoria"] intValue];

Problem

In my app I am retrieving data from a MySQL database using JSON. One of the table fields is idCategoria, from type integer. Now I am trying to assign the idCategoria value to a int variable in my app, but this showing a compiler warning. I have logged the value for categoriaID an it is 143913536 but should be 1. This is the warning shown: ``` Incompatible pointer to integer conversion initializing 'int' with an expression of type 'id' ``` And this is how I am trying to do this: ``` int categoriaID = [categoriaDescription objectForKey:@"idCategoria"]; ```

Original source