开发者

Missing bracket Issue

Am having trouble finding a problem in Xcode which keeps it from compiling. The error I get is Expected ']' before ';' token

Can you help me find the problem?

Here is the method in the implementation file:

- (IBAction) sendBut开发者_高级运维tonTapped:(id)sender
{
    NSString* themessage = [NSString stringWithFormat:@"I'm %@ and feeling %@ about it.",
                                [activities objectAtIndex:[tweetPicker selectedRowInComponent:0]];
    [feelings objectAtIndex:[tweetPicker selectedRowInComponent:1]]];
    NSLog(themessage);
}

Thanks in advance!


You have ';' in 2nd line which should be ':

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


(1) derp. what the other guy said; your brackets are all outta whack w/your ;s

(2) never pass a string directly to NSLog(); if you want to just log a string, do NSLog(@"%@", aString);.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜