When allocating and defining your NSString
Code:
NSString *str = [[NSString alloc] initWithFormat:@"Hello, %@", txtName.text];
did you include the dot operator?
I can recreate your error if the line is
Code:
NSString *str = [[NSString alloc] initWithFormat:@"Hello, %@", txtName];
If this is not the error post your -(IBAction)btnClicked method in a response, in case a typo or error of omission has occurred. It will make it easier to rule out possible causes for the error.