2012-04-02 108 views
1

這是可能的重複請求成員XXXX的東西不是結構或聯合。 但我找不到我的錯誤的任何答案。 我的錯誤代碼:請求成員「nameField」中的東西不是結構或聯合:錯誤

if (!buttonIndex == [actionSheet cancelButtonIndex]) 
    NSString *msg = nil; 
    if (nameField.text.length > 0) 
     msg = [[NSString alloc] initWithFormat:@"You can breathe easy, %@, EveryThing went ok".nameField.text]; 
    else 
     msg = @"You can breathe easy, everything went ok"; 
} 

我在這一行if(nameField.text.length >0) 我是新來的OBJ C.錯誤誰能幫我調試了嗎?

+0

嘗試(。) if([nameField.text length]> 0) – Hiren 2012-04-02 05:33:28

+0

Thx dude。但是得到** Expected「:」before「]」token **錯誤。 – 2012-04-02 05:36:59

回答

1

您的代碼行

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

試試這個

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

在該行改變你已經使用。逗號,而不是在這裏 - >:@」 ...‘

檢查,如果這有助於

+0

ios Center。謝謝你。 – 2012-04-02 05:47:21

0

你有一個點,你應該在initWithFormat有後確定一個逗號’

相關問題