缺少括号问题

时间:2011-04-04 20:10:20

标签: objective-c xcode

无法在Xcode中找到问题而无法编译。我得到的错误是Expected ']' before ';' token

你能帮我找到问题吗?

以下是实现文件中的方法:

- (IBAction) sendButtonTapped:(id)sender
{
    NSString* themessage = [NSString stringWithFormat:@"I'm %@ and feeling %@ about it.",
                                [activities objectAtIndex:[tweetPicker selectedRowInComponent:0]];
    [feelings objectAtIndex:[tweetPicker selectedRowInComponent:1]]];
    NSLog(themessage);
}

提前致谢!

2 个答案:

答案 0 :(得分:4)

你有';'在第二行应该是':

NSString* themessage = 
         [NSString stringWithFormat:@"I'm %@ and feeling %@ about it.",
              [activities objectAtIndex:[tweetPicker selectedRowInComponent:0]],
              [feelings objectAtIndex:[tweetPicker selectedRowInComponent:1]]
         ];

答案 1 :(得分:2)

(1)derp。那个人说的是什么;你的括号都是你的;你的

(2)永远不会将字符串直接传递给NSLog();如果您只想记录字符串,请执行NSLog(@"%@", aString);