View Full Version : NSString not responding to stringWithFormat !

Jul 5, 2008, 02:53 AM
Hello all,

I am quite a newbie in all this programming stuff...
I got into it due to the pending 2.0 iPhone software, and I am trying to write an app for the iPhone, using the SDK and Obj-C...

Here is my problem :

The object of my app is to decode an 8 character code that can contain either numbers or "/"...

The first 2 characters should be numbers, and will decode into a runway identification

I have extracted the 8 characters from the UITextField receiving it into a string called "string";

then i "dispatched" the first 2 digit into a new string called "piste" :

piste = [string substringWithRange:NSMakeRange(0,2)];

Then I extracted the numerical value of the string "piste" into an int called pisteInt:

NSScanner *scanner;
scanner = [NSScanner scannerWithString:piste];
[scanner scanInt: &pisteInt]; // ATTENTION, returns O if no int found...!

I am now sending the decoded text into a UILabel called "labelPiste" , but I have to input that numerical value into the label, so I'm trying :

if (pisteInt <= 36)
{NSString *piste01a36 = [NSString stringwWithFormat:@"Piste %i(L)", pisteInt];
labelPiste.text = piste01a36;

But I get the warning : 'NSString may not respond to '+stringWithFormat'
(Messages without a matching method will be assumed to return 'id' and accept '...' as arguments.)

Can anyone help ?

Jul 5, 2008, 03:25 AM
stringwWithFormat <-- note the wW instead of W

Jul 5, 2008, 06:15 AM
You've GOT to be kidding me ! !

Sorry, and thanks !

(how the hell do you pick this up so fast !!?)

thanks !

Jul 6, 2008, 08:14 AM
code completion is a useful feature of the IDE. press ESC next time u think u might spell something incorrectly.