NSString not responding to stringWithFormat !

Discussion in 'iPhone/iPad Programming' started by deamb, Jul 5, 2008.

  1. macrumors newbie

    Joined:
    Jul 5, 2008
    Location:
    Barcelona
    #1
    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" :

    Code:
    piste = [string substringWithRange:NSMakeRange(0,2)];
    
    Then I extracted the numerical value of the string "piste" into an int called pisteInt:
    Code:
    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 :

    Code:
    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. macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #2
    stringwWithFormat <-- note the wW instead of W
     
  3. thread starter macrumors newbie

    Joined:
    Jul 5, 2008
    Location:
    Barcelona
    #3
    You've GOT to be kidding me ! !

    Sorry, and thanks !

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

    thanks !
     
  4. macrumors regular

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

Share This Page