How to convert NSIndexPath to NSInteger?

tarheel picture tarheel · Dec 18, 2011 · Viewed 8.5k times · Source

I have searched and found a previous answer for this question here. The problem is that the answer marked as a solution does not work. Inside my tableView:didSelectRowAtIndexPath: method, I have

NSInteger *currentRow = indexPath.row;

and it gives me the warning 'Incompatible integer to pointer conversion initializing 'NSInteger *'(aka 'int *') with an expression of type 'NSInteger' (aka 'int').

Any help is appreciated!

Answer

Isabel picture Isabel · Dec 18, 2011

NSInteger is not a class, so it doesn't need an asterisk:

NSInteger currentRow = indexPath.row;