简体   繁体   English

指向类型为“ id”的表达式的整数转换“ int”的指针不兼容

[英]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.

相关问题 “指向整数转换的不兼容指针,使用类型'NSNumber *'的表达式初始化'int'” - “Incompatible pointer to integer conversion initializing 'int' with an expression of type 'NSNumber *'” 指针转换“ int”到参数类型“ id”的整数不兼容 - incompatible integer to pointer conversion “int” to parameter type of “id” 不兼容的指向整数转换的指针,将“ id”发送到“ int”类型的参数 - Incompatible pointer to integer conversion sending 'id' to parameter of type 'int' 整数转换的不兼容指针,从“ id”分配给“ int” - Incompatible pointer to integer conversion assigning to 'int' from 'id' 指针转换不兼容的整数,向“ uilabel”类型的参数发送“ int” - Incompatible integer to pointer conversion sending 'int' to parameter of type uilabel Getter Setter:不兼容的指针转换,将“ int”发送到类型为“ int *”的参数 - Getter Setter : Incompatible Integer to pointer conversion sending 'int' to parameter of type 'int *' 与指针转换不兼容的整数将'NSInteger'(又名'int')发送到'NSInteger *'类型的参数(又名'int *') - Incompatible Integer to pointer conversion sending 'NSInteger' (aka 'int') to parameter of type 'NSInteger *' (aka 'int *') 不兼容的整数到指针转换从'int'分配给'int *' - Incompatible integer to pointer conversion assigning to 'int *' from 'int' 指向整数转换的不兼容指针从结果类型为“NSInteger”(又名“long”)的函数返回“id _Nullable” - Incompatible pointer to integer conversion returning 'id _Nullable' from a function with result type 'NSInteger' (aka 'long') 不兼容的整数到指针转换从'int'分配给'CGFloat *'(又名'float *') - Incompatible integer to pointer conversion assigning to 'CGFloat *' (aka 'float *') from 'int'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM