Skip to content

November 14, 2014

‘initWithCString:’ is deprecated: first deprecated in iOS 2.0

by noise

Let’s say we got the following warning when trying to compile an Objective C code:

‘initWithCString:’ is deprecated: first deprecated in iOS 2.0

The line is:

NSString* nsString = [[NSString alloc] initWithCString: fileNameWE];

To solve the warning we will use stringWithFormat method instead so our modified code is:

NSString* nsString =[NSString stringWithFormat:@"%s", fileNameWE];
Read more from Objective C Tips

Leave a Reply

required
required

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments