Hey guys,
I noticed something interesting.
I have an Item class and one of its parameters is
NSString *name;
In a UITextField, I have this code:
Quote:
- (BOOL)textFieldShouldReturn UITextField *)textField
{
// name is defined in .h as NSString *name;
[nameTF resignFirstResponder];
name = nameTF.text;
NSLog(@"name from UITextField is %@", name);
return YES;
}
|
then later on,
Quote:
-(IBAction)donePressed
{
[newItem setName:name];
[newItem setQuantity:quantity];
[newItem setStatus:status];
// pop the view from the Navigation stack
[[self navigationController] popViewControllerAnimated:TRUE];
}
|
Now, in the UITextField, if I type item1, it works. However, when I type item 1 with a space between item and 1, it gives EXC BAD ACCESS error.
I'm a little stumped because I thought it's a string and spaces are allowed. Any ideas?
Thanks!