Question

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

Was it helpful?

Solution

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).

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top