When I try to add nsinteger value into array it shows warning,
Incompatible pointer to integer conversion sending 'NSInteger *' (aka 'int *') to parameter of type 'NSInteger' (aka 'int'); dereference with *
and crashed when reach the code
[sizary1 addObject:[NSNumber numberWithInteger:Quant.quantity]];
quantity declared as
@property (nonatomic) NSInteger * quantity;
What change should I made?
1)You are using quantity
as a Pointer in this case.So NSInteger
doesn't allow to pointer in this case.
2)You're passing quantity
to numberWithInteger:, which takes an NSInteger. It's nothing to do with the setObject:. You probably want to either copy quantity
or just pass in quantity to setObject: directly.