Xcode is telling me that I’m missing a ‘)’ but I can’t tell where it should go; it makes no sense to me. Have commented out the error message.
Can you look at the code and tell me where it’s wrong?
Thank you.
CalculatorViewController.m
#import "CalculatorViewController.h"
@interface CalculatorViewController()
@property (nonatomic) BOOL userIsInTheMiddleOfEnteringANumber;
@end
@implementation CalculatorViewController
@synthesize display;
@synthesize userIsInTheMiddleOfEnteringANumber;
- (IBAction)digitPressed:(UIButton *)sender
{
NSString *digit = [sender currentTitle];
self.display.text = [self.display.text stringByAppendingString:digit];
if (self userIsInTheMiddleOfEnteringANumber) { // Expected ')'
self.display.text = [self.display.text stringByAppendingString:digit];
} else {
self.display.text = digit;
self.userIsInTheMiddleOfEnteringANumber = YES;
}
}
@end
Actually, you’re missing brackets. Xcode just assumed you didn’t want them since you didn’t have an open bracket, so you got the error that you didn’t close your parentheses.