I'm having a bit of a problem whereby anything entered in a UITextField that's passed into a method in a new view controller (which the app subsequently moves to) seems to crash the app if the entered text contains a space and I try and write that string to NSLog or to the new view controller somewhere.
For example, I've got a view controller with: (pseudo-code)
And a new view controller with:
If the text I enter into the UITextField doesn't contain a space, everything works perfectly; but if I do enter a space weird things happen - the NSLog entry causes the app to crash, and setting the text of the label displays something weird, like "( )". I've tried using either %s or %S in place of %@, but then I just get really strange results of bizarre character strings.
For example, I've got a view controller with: (pseudo-code)
Code:
UITextField *myTextField;
[newViewController handleText:myTextField.text];
And a new view controller with:
Code:
UILabel myLabel;
- (void)handleText:(NSString *)myText {
NSLog([NSString stringWithFormat:@"passed text: %@", myText]);
myLabel.text = myText;
}
If the text I enter into the UITextField doesn't contain a space, everything works perfectly; but if I do enter a space weird things happen - the NSLog entry causes the app to crash, and setting the text of the label displays something weird, like "( )". I've tried using either %s or %S in place of %@, but then I just get really strange results of bizarre character strings.