Maulik
Maulik

Reputation: 19418

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 without a cast "

what is wrong ?

Thanks..

Upvotes: 0

Views: 70

Answers (4)

Twelve47
Twelve47

Reputation: 3984

It should just be:

int count

You don't want to use a pointer.

Upvotes: 3

ajay
ajay

Reputation: 3345

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

Upvotes: 2

JeremyP
JeremyP

Reputation: 86651

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.

Upvotes: 4

Rakesh Bhatt
Rakesh Bhatt

Reputation: 4606

int *count;

:O

it shoud be int count;

Upvotes: 3

Related Questions