Incompatible integer to pointer conversion assigning to 'int *' from 'int' Incompatible integer to pointer conversion assigning to 'int *' from 'int' objective-c objective-c

Incompatible integer to pointer conversion assigning to 'int *' from 'int'


There's a big hint in the error message!

In C and Objective C, an int is a primitive data type. You've written int *, which means "a pointer to an int", whereas it looks like you just wanted an int.

So change your property to this:

@property (nonatomic, assign) int myInt;

For more info, google "C pointers" and you'll find information like this: http://pw1.netcom.com/~tjensen/ptr/pointers.htm


Yes, simply remove asterisk (*) from declaration.

for example.declare BOOL isChecked instead of BOOL * isChecked.


Another way to resolve this is to simply not declare a pointer (drop the asterisk):

@interface ViewController : UIViewController {    NSUInteger myObjcInt;  // unsigned ( >= 0 ) NSObject int, yo}