开发者

objective c warning

I am parsing an XML but having some problem regrading its attribute. I wan to fetch a value and want to convert into int. in my .h file I have declared

int *count;

and set property (nonatomic , readwrite)int *count;

in .m file

self.count = [[attributeDict objectForKey:@"count"] intValue];

but it gives error " warning: initialization makes pointer from integer w开发者_Python百科ithout a cast "

what is wrong ?

Thanks..


Because you have declared your instance variable as a pointer to an int instead of as an int. Drop the * from the instance variable and the property declaration and make sure the property is assign not retain.


int *count;

:O

it shoud be int count;


It should just be:

int count

You don't want to use a pointer.


use int count that is enough.dont use pointer..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜