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

  • SEARCH
  • Home
  • 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 9142455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:47:13+00:00 2026-06-17T09:47:13+00:00

I must be missing something simple here. Anyway, I started out by just making

  • 0

I must be missing something simple here. Anyway, I started out by just making a regular function,

NSDecimalNumber* aa(NSMutableString *string)
{code}

which I would then call by pressing a button like so:

- (IBAction)parse:(id)sender {
string1=[NSMutableString stringWithFormat:@"%@", screen.text];
NSDecimalNumber *output=aa(string1);}

(screen.text is from a label) However, partway into it, I realized that the function can’t use variables from the rest of my viewcontroller.m class (and vice-versa), so I decided to implement the function as a method instead. Here’s what I did. First, I added this to viewcontroller.h,

+ (NSDecimalNumber*) aa:(NSMutableString*) string;
@property (nonatomic, strong) NSDecimalNumber *number; //the number I'm working with

synthesized my property, changed my function declaration to this,

+ (NSDecimalNumber*) aa:(NSMutableString*) string

and attempted to call it like this,

NSDecimalNumber *output=[[NSDecimalNumber alloc] aa:string1];

With that attempt, I got two errors — “No visible @interface for ‘NSDecimalNumber’ declares the selector ‘aa,'” and “instance variable ‘number’ accessed in class method.”

So I tried again with an instance method. Changed the +’s to -‘s and instead called the method with

NSDecimalNumber *output;
[output aa:string1];

That corrected the second error but not the first one. I can’t figure out why it isn’t recognizing the method in the @interface. Also, those weren’t the only things I’ve tried changing — I’ve been playing around with multiple ways to call the method, but nothing seems to work. Any ideas?

  • 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-17T09:47:14+00:00Added an answer on June 17, 2026 at 9:47 am

    This function call:

    NSDecimalNumber *output=[[NSDecimalNumber alloc] aa:string1];
    

    ..is attempting to call aa an instance of NSDecimalNumber. I don’t think that’s what you want, isn’t your aa method a member of your class? Also, you’re not calling a class initializer (although you don’t need to, since your method is static so long as its definition starts with +):

    // MyClass method definition
    + (NSDecimalNumber*) aa:(NSMutableString*) string
    
    // Called with
    NSDecimalNumber *output=[MyClass aa:string1];
    

    –UPDATE–

    To address the “instance variable” error, you need to make the method an instance method. Change + in definition to - and call it thusly:

    // MyClass method definition
    - (NSDecimalNumber*) aa:(NSMutableString*) string
    
    // Call it like this _if calling from within MyClass only_ (hence, "self")
    NSDecimalNumber *output = [self aa:string];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think i must be missing something simple here but I can't figure out
OK I must be missing something really simple here. I just want to return
I must be missing something totally obvious here. I just started with a clean
I must be missing something simple here, but I'm having trouble retrieving data from
I feel like I must be missing something simple here... Nothing sends, nor do
I must be missing something incredibly simple here, but I cannot for the life
I feel as though I must be missing something simple here - what I
Okay, I must be missing something utterly simple here, because I've been googling for
I think I must be missing something very simple here (and apologies if I
Okay, I must be missing something here because this should be extremely simple, yet

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.