NSString initWithFormat returns "..."
<p>I have just started developing for iPhone (I've been an Android developer for quite some time) and am having a problem with a very very...mundanely simple task: changing the text of a text label. I followed the Apple developer tutorial, but there is a problem with the initWithFormat method of NSString.</p>

<p>The issue is in this method:</p>

<pre><code>-(IBAction)changeGreeting:(id)sender {

    self.userName = self.textField.text;

    NSString *nameString = self.userName;
    if ([nameString length] == 0) {
        nameString = @"World";
    }

    NSString *greeting = [[NSString alloc] initWithFormat:@"Hello, %@!", nameString];
    self.label.text = greeting;
}
</code></pre>

<p>When I run the project, whether there is a value in textField or not, the label is always set to Hello,...</p>

<p>When I change the last line of the method to:</p>

<pre><code>self.label.text = self.userName;
</code></pre>

<p>or to:</p>

<pre><code>self.label.text = nameString;
</code></pre>

<p>The label displays the value that SHOULD be inserted at the %@ in the initWithFormat call. Note: I have also tried using stringWithFormat and I get the same problem.</p>

<p>Thanks.</p>
