clearCache code causes warning now in xCode 5.1


#1
  • (void) clearCache:( NSNotification *) note
    {
    NSLog(@" flushing %d images out of the cache", [self.dictionary count]);

}

That WILL cause a WARNING message now in XCODE 5.1 if you run in the simulator for a 64-bit device.

" Values of type ‘NSUInteger’ should not be used as format arguments; add an explicit cast to ‘unsigned long’ instead"

Xcode allows you to now ‘double click’ on the ‘fix it’ item and it will replace it with this:

NSLog(@“Flushing %lu images out of the cache”, (unsigned long)[self.dictionary count]);

Change is here to stay. =)


#2

Use (int) to cast the returned NSInteger to int?


#3

I think it should be ‘long’ if supporting both 32 and 64 bit since NSInteger is int in 32bit while long in 64bit.

    NSInteger i = 100;
    NSLog(@"%ld", (long)i);