*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '*** -[NSPlaceholderString initWithUTF8String:]: NULL cString'
views:
22answers:
2
+1
A:
So that means you're doing this:
NSString *myString = [NSString stringWithUTF8String: NULL];
so just use the backtrace you elided from this question to find out where you're doing that, and initialise the character array correctly.
Graham Lee
2010-06-28 08:02:46
A:
cString is a method of the NSString class.
So this error means the method is called on a nil NSString. It will return nil, and the initWithUTF8String method of NSPlaceholderString will raise an exception.
Try to use NSLog() at some points to see where the nil string comes from. It may be that sort of things:
NSString * str;
if( someTest )
{
str = @"foo"
}
/* No else statement - so uninitialized string */
Macmade
2010-06-28 08:04:41
NSLog()? Woah, old school. The static analyzer can catch that kind of bug (not that it can actually be the cause of the questioner's crash).
Graham Lee
2010-06-29 14:42:04