Problem:
Yesterday I converted a large project of mine to support arm64 and after that I got 500+ warnings at once. About 70% of them are where NSInteger
is being assigned to int or vice versa, and remaining are where NSUInteger is formatted in NSString
like this:
NSInteger a = 123;
NSString *str = [NSString stringWithFormat:@"Int:%d", a]; //warning: value of 'NSInteger' should not be used as formate argument; add an explicit cast to 'unsigned long' instead.
Now I do know how to adress them manually, but that's a huge task and very laborious. I'm also aware that I can silence the type mismatch warnings all together, but I don't want to do that. Of course, they're very helpful.
What I've tried:
- I've converted
[NSNumber numberWithInt:abc];
to[NSNumber numberWithInt:(int)abc];
using find-n-replace. It fixed some. I've also tried to change all my int properties to NSInteger properties but it doubled the number of warnings (reached to 900+ count). So I reverted.
I've also tried to find some regular expression but couldn't find something suitable to my needs.
Question:
I'm looking for a regular expression or any other workaround somebody has tried which can reduce the amount of work needed to fix them manually.
Thanks in advance.