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);
.
精彩评论