One off errors with NSLog and NSString stringWithFormat

Posted by David Liu on Stack Overflow See other posts from Stack Overflow or by David Liu
Published on 2010-05-06T01:55:55Z Indexed on 2010/05/06 1:58 UTC
Read the original article Hit count: 340

Filed under:
|
|

Does anyone know why there would be one-off errors with NSLog and NSString? It works fine in 99% of my program, but for some reason this error appears in one of my model's description method:

Example code:
localFileId = 7;
type = 2;
localId = 5;
NSLog(@"CachedFile localId=%d, 2=%d, localFileId=%d, type=%d, path=%@", localId, 2, localFileId, type, self.path);

Example Result: 
CachedFile localId=5, 2=0, localFileId=2, type=7, path=(null)

Notice the "0" that gets inserted in there, where it should be "2=2". This happens with NSString stringWithFormat as well.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c