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.