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 8224961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:15:07+00:00 2026-06-07T15:15:07+00:00

I don´t understand what I might be doing wrong here since I am following

  • 0

I don´t understand what I might be doing wrong here since I am following an instruction book – on setting the value calling a method of an class. I have #imported it, and everything should be fine. But Xcode complains: no know class method selector for “setWeightInKilos and “setHeightInMeters”. These instance methods are implemented in the “Person” class so I do not know why this happens.

    Person *aPerson = [[Person alloc] init]; 
    [Person setWeightInKilos:96];
    [Person setHeightInMeters:1.8];
    float bmi = [Person bodyMassIndex];
  • 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-07T15:15:09+00:00Added an answer on June 7, 2026 at 3:15 pm

    In Objective C, there are two types of methods. Class methods, which do not act on an object, but instead usually perform some task related to that TYPE of object. For example, there are built in methods to test for network connections, device capabilities, etc. These are always denoted with a “+” sign, and cannot be called on instances of objects, only the class itself.

    The other type, instance methods, are MUCH more common, and act on objects that you instantiate or create yourself. These are the methods that you write in the implementation file with a “-” prefix. They are things like getters, setters, or methods that you have written yourself.

    In your case, you need to call these setter methods on the instance of your Person object, not the Person class itself. It doesnt make sense to set the height or weight of the entire class (nor is it possible), since every object will need to have its own unique height and weight.

    You need to call:

    Person *aPerson = [[Person alloc] init]; 
    [aPerson setWeightInKilos:96];
    [aPerson setHeightInMeters:1.8];
    float bmi = [aPerson bodyMassIndex];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this is something I'm probably doing wrong, so please don't incinerate me
I'm pretty new to MSBuild, so I might be doing something obviously-wrong, but a
I don't understand the output of this program: int arr[]={1,7,4,2,5,8}; int x=(&(arr[arr[1]-arr[4]])-arr); printf(%d ,x);
I don't understand why a vector 's iterator should be invalidated when a reallocation
I don't understand MEF very well, so hopefully this is a simple fix of
I don't understand this behavior in javascript for inheritance I've always seen it defined
I don't understand why this is not working. It should be very easy. upload.php
I don't understand how this example can possibly work: double * GetSalary() { double
I don't understand what happening in my application. My app structure: EventListActivity (List of
I don't understand behavior of glassfish v3.1.2. I run my java web-application with such

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.