I've been using genstrings
to build strings files to internationalize my iPhone app. However, some changes I made recently have caused the genstrings
tool to start throwing errors like this:
s1075-88:Directory jason$ genstrings -o en.lproj *.m
2011-02-26 16:42:26.941 genstrings[17962:903] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFString characterAtIndex:]: Range or index out of bounds'
*** Call stack at first throw:
(
0 CoreFoundation 0x00007fff82a267b4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x00007fff85c640f3 objc_exception_throw + 45
2 CoreFoundation 0x00007fff82a265d7 +[NSException raise:format:arguments:] + 103
3 CoreFoundation 0x00007fff82a26564 +[NSException raise:format:] + 148
4 Foundation 0x00007fff841a65e1 -[NSCFString characterAtIndex:] + 97
5 genstrings 0x0000000100001b9d 0x0 + 4294974365
6 genstrings 0x0000000100003080 0x0 + 4294979712
7 genstrings 0x0000000100003ee6 0x0 + 4294983398
8 genstrings 0x0000000100000d20 0x0 + 4294970656
)
What could be causing this, and how can I find the part of my project which is causing it without manually changing everything?
No easy tricks here.
copy all your .m files to a separate folder then do a binary search.
run genstrings on half the files and see if the problem is there or not. isolate which half of the files have the problem and do it again...
It's a bug inside genstrings, so not much you can do about it.