views:

477

answers:

2

Hi All,

I am getting a warning while creating the NSIndexPath,

NSInteger arr[] = {0,3}; [NSIndexPath indexPathWithIndexes:arr length:2]

warning: pointer targets in passing argument 1 of 'indexPathWithIndexes:length:' differ in signedness

What is the warning due to ?? How to make it work?

Thanks

A: 

Assuming you're developing for the iPhone, you should use the UIKit additions intended for creating index paths to represent positions in UITableViews. You should construct your example like so: NSIndexPath *myIndexPath = [NSIndexPath indexPathForRow:0 inSection:3]; See this Apple documentation for more information.

Mike
That's iPhone only though, and he did not specify iPhone in the tags...
Kendall Helmstetter Gelner
+2  A: 

You need to have the array be of type NSUInteger (unsigned).

It's telling you that because NSIndexPath does NOT want negative values, which you could potentially be passing in via an NSInteger array (really an int).

Kendall Helmstetter Gelner
Thanks... it worked.
Biranchi