NSString not responding to stringWithFormat !

Discussion in 'iOS Programming' started by deamb, Jul 5, 2008.

  1. deamb macrumors newbie

    Jul 5, 2008
    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 ?
  2. Catfish_Man macrumors 68030


    Sep 13, 2001
    Portland, OR
    stringwWithFormat <-- note the wW instead of W
  3. deamb thread starter macrumors newbie

    Jul 5, 2008
    You've GOT to be kidding me ! !

    Sorry, and thanks !

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

    thanks !
  4. rand0m3r macrumors regular

    Jun 30, 2006
    code completion is a useful feature of the IDE. press ESC next time u think u might spell something incorrectly.

Share This Page