advertencias NSIndexPath en Obj-C
-
19-09-2019 - |
Pregunta
Me estoy haciendo una advertencia al crear el NSIndexPath,
NSInteger arr[] = {0,3};
[NSIndexPath indexPathWithIndexes:arr length:2]
warning: pointer targets in passing argument 1 of 'indexPathWithIndexes:length:' differ in signedness
¿Cuál es la advertencia debido a ?? Cómo hacer que funcione?
Gracias
Solución
Es necesario tener la matriz sea de tipo NSUInteger
(sin firmar).
Se te está diciendo que debido a NSIndexPath NO quiere valores negativos, lo que potencialmente podría estar pasando a través de una matriz NSInteger (en realidad un int).
Otros consejos
Suponiendo que se está desarrollando para el iPhone, debe utilizar las adiciones UIKit destinados a la creación de caminos de índice para representar posiciones en UITableViews
. Usted debe construir su ejemplo, así: NSIndexPath *myIndexPath = [NSIndexPath indexPathForRow:0 inSection:3];
Ver esta documentación de Apple para más información