[英]Incompatible pointer to integer conversion 'int' with an expression of type 'id'
In my app I am retrieving data from a MySQL database using JSON. 在我的应用程序中,我正在使用JSON从MySQL数据库中检索数据。
One of the table fields is idCategoria, from type integer. 表字段之一是idCategoria,来自整数类型。 Now I am trying to assign the idCategoria value to a int variable in my app, but this showing a compiler warning. 现在,我尝试将idCategoria值分配给我的应用中的int变量,但这显示了编译器警告。 I have logged the value for categoriaID an it is 143913536 but should be 1. 我已记录categoriaID的值,它是143913536,但应为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"];
尝试:
int categoriaID = [[categoriaDescription objectForKey:@"idCategoria"] intValue];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.