1

after getting a lot of warnings when changing (by accident) the simulator (from 32 to 64 bit platforms), I'm getting rid of all the int declaration and changing those for NSintegers.

But I have another warning in this piece of code:

- (IBAction)nextText:(UIBarButtonItem *)sender {

    NSInteger i=[self.indexPathArray indexOfObject:[self indexPathForActiveText]];
    //before it was int i=... 

    if (i<[self.indexPathArray count]-1) {

        [self moveRows:++i];
    }
}

however on the line [self moveRows:++i]; I get this warning again:

'implicit conversion loses integer precision:...'

Cœur
  • 37,241
  • 25
  • 195
  • 267
Marcal
  • 1,371
  • 5
  • 19
  • 37
  • 1
    show `moveRows:` declaration or definition... – Mani Apr 01 '14 at 08:39
  • 1
    There's a hidden bug in your condition `i < [self.indexPathArray count] - 1` (for an empty `indexPathArray`). Change it to `i + 1 < [self.indexPathArray count]`. – Nikolai Ruhe Apr 01 '14 at 08:58
  • Good call, thanks. I made sure in my implementation that the array is never empty, but one is never too sure. Thanks. – Marcal Apr 01 '14 at 09:35

1 Answers1

3

It should show warning in 64-bit platform. NSInteger i=[self.indexPathArray indexOfObject:[self indexPathForActiveText]]; Because indexOfObject: return NSUInteger. So your code should be as below

NSUInteger i=[self.indexPathArray indexOfObject:[self indexPathForActiveText]];

And also

-(void)moveRows:(NSUInteger)index;

See this apple's doc

Mani
  • 17,549
  • 13
  • 79
  • 100
  • THANKS SO MUCH!! I'm getting acquaintance with the whole thing, after a long pause on programming. Thanks again! – Marcal Apr 01 '14 at 08:49