No visible interface error

I have an error in the implementation file for my model which I have commented out. What can I do to fix this problem?

Thanks in advance.

  • Monitor keyboard events inside process (Process Wide)
  • How to design an UIScrollView in storyboard
  • iAd works in iPhone but not iPad
  • How to move the views from a XIB file to storyboards in a project in Xcode?
  • Warning during archive App with iOS 8 Extension in Xcode 6
  • UIPageViewController - first rotation resets views to initial page?
  • #import "CalculatorBrain.h"
    @interface CalculatorBrain()
    @property (nonatomic, strong) NSMutableSet *operandStack;
    @implementation CalculatorBrain
    @synthesize operandStack = _operandStack;
    - (NSMutableArray *)operandStack
        if (!_operandStack) {
            _operandStack = [[NSMutableArray alloc] init];
        return _operandStack;
        NSNumber *operandObject = [NSNumber numberWithDouble:operand];
        [self.operandStack addObject:operandObject];
    - (double)popOperand
        NSNumber *operandObject = [self.operandStack lastObject]; // No visible interface for 'NSMutableSet' declares the selector 'lastObject'
        if(operandObject)   [self.operandStack removeLastObject]; // No visible interface for 'NSMutableSet' declares the selector 'removeLastObject'
        return [operandObject doubleValue];
    - (double)performOperation:(NSString *)operation
        double result = 0;
        if([operation isEqualToString:@"+"]) {
            result = [self popOperand] + [self popOperand];
        } else if ([@"*" isEqualToString:operation]) {
            result = [self popOperand] * [self popOperand];
        } else if ([operation isEqualToString:@"-"]) {
            double subtrahend = [self popOperand];
            result = [self popOperand] - subtrahend;
        } else if ([operation isEqualToString:@"/"]) {
            double divisor = [self popOperand];
            if (divisor)result = [self popOperand] / divisor;
        [self pushOperand:result];
        return result;

    2 Solutions Collect From Internet About “No visible interface error”

    You have declared your operandStack property as an NSMutableSet, but you should have declared it as an NSMutableArray:

    @property (nonatomic, strong) NSMutableArray *operandStack;

    You are trying to get the “last object” of an NSSet – this is impossible, as sets are unordered. The method lastObject does not exist for NSMutableSet.

    You might want to try using an NSMutableArray instead.