Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8719543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:49:27+00:00 2026-06-13T06:49:27+00:00

UPDATE It turns out that I was calling a class method on an instance

  • 0

UPDATE

It turns out that I was calling a class method on an instance of that class.

I’ve fixed that line of code to be:

double result = [CalculatorBrain runProgram:[self.brain program] usingVariableValues:[self variableValues]];

But when I run the program and that line is evaluated, I get the following error:

+[CalculatorBrain runProgram:usingVariableValues:]: unrecognized selector sent to class 0x6908

ORIGINAL

Why am I getting the following error in XCode inside of the view’s enterPressed: No visible @interface for ‘CalculatorBrain’ declares the selector ‘runProgram:usingVariableValues:’ ?

** CalculatorViewController.m **

#import "CalculatorViewController.h"
#import "CalculatorBrain.h"

@interface CalculatorViewController()

@property (nonatomic, strong) CalculatorBrain *brain;
@property (nonatomic, strong) NSMutableDictionary *variableValues;

@end

@implementation CalculatorViewController

@synthesize brain = _brain;
@synthesize variableValues = _variableValues;

- (CalculatorBrain *)brain {
    if (!_brain) _brain = [[CalculatorBrain alloc] init];
    return _brain;
}

- (NSMutableDictionary *)variableValues {
    if (!_variableValues) {
        _variableValues = [[NSMutableDictionary alloc] init];
    }
    return _variableValues;
}

- (IBAction)enterPressed {

    double *result = [self.brain runProgram:[self.brain program] usingVariableValues:[self variableValues]];

}

** CalculatorBrain.h **

#import <UIKit/UIKit.h>

@interface CalculatorBrain : NSObject

+ (double)runProgram:(id)program usingVariableValues:(NSDictionary *)variableValues;

@property (readonly) id program;


@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T06:49:28+00:00Added an answer on June 13, 2026 at 6:49 am

    In CalculatorBrain.h, you’re declaring a class method instead of an instance method:

    + (double)runProgram:(id)program usingVariableValues:(NSDictionary *)variableValues;
    

    Use - instead of +.

    Or, if you intend this to be a class method, call it as such:

     double *result = [CalculatorBrain runProgram:[self.brain program] usingVariableValues:[self variableValues]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

UPDATE It turns out that the code below is not actually the problem. In
Update: Turns out this is undocumented behaviour of the NetStream class - NetStream loads
Update: Turns out that this problem was because half my mongrel did not restart.
Update: Turns out that this is a duplicate of: JSLint: Using a function before
Update: It turns out that Twitter doesn't know single tweet ID from URL fragment
UPDATE Turns out I'm just tired. There isn't any problem here sorry for wasting
UPDATE: As it turns out, the below is caused by a caching issue on
Edit! Turns out I had just got too many apostrophes going on when calling
EDIT: It turns out that the problem was with an input parm. Apparently, if
Update : this is more-or-less a dupe , and it turns out to be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.