Interesting problem with spaces

Discussion in 'iOS Programming' started by Buschmaster, Aug 16, 2008.

  1. Buschmaster macrumors 65816

    Buschmaster

    Joined:
    Feb 12, 2006
    Location:
    Minnesota
    #1
    This one is funky...

    I have a controller and a view.

    The view contains a single textfield and several NSStrings.
    The view will have the user enter the info and will store it in the NSStrings.
    The view controller will then create a NSDictionary and send that to the delegate.

    Anyway, all of that works fine and just to plan unless you use a space in the text field and in that case it crashes the app.

    I tried something like this in the textFieldDidEndEditing:
    Code:
    myFirstNSStringValue = [[textField text] stringByReplacingOccurrencesOfString:@" " withString:@""];
    
    As well as striping the white spaces just as a temporary fix until I can get past the spaces problem overall. But neither worked.

    Any ideas?
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    Sounds like there's something else is going on. What kind of crash is being generated?
     
  3. Buschmaster thread starter macrumors 65816

    Buschmaster

    Joined:
    Feb 12, 2006
    Location:
    Minnesota
    #3
    The only thing is that it works perfectly unless you use the spaces. I'll continue to test and see if there are other ways I can crash it or ways it'll work if I do use spaces.

    The kind of crash is where the application just freezes and dies a painful death.
     
  4. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #4
    Have you tried launching with the debugger? That'll usually show you the stack trace.
     

Share This Page