New Xcoder
New Xcoder

Reputation: 545

Request for member "nameField" in something not a struct or union :error

My Error message:

Request for member "nameField" in something not a struct or union

My Error code:

NSString *msg = nil;
if (nameField.text.length > 0)
    msg = [[NSString alloc] initWithFormat:@"Relax, %@, all is good".nameField.text];
else
    msg = @"Relax, all is good";

Upvotes: 0

Views: 121

Answers (2)

hp iOS Coder
hp iOS Coder

Reputation: 3234

your code line

msg = [[NSString alloc] initWithFormat:
       @"You can breathe easy,%@, EveryThing went ok". nameField.text];

try this

msg = [[NSString alloc] initWithFormat:
       @"You can breathe easy,%@, EveryThing went ok", nameField.text];
                                                     ^

change in the line is you have used. instead of comma here -> :@"...",

check if this helps

Upvotes: 1

ChrisPadgham
ChrisPadgham

Reputation: 870

you have a dot (.) where you should have a comma after ok" in the initWithFormat

Upvotes: 0

Related Questions