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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:01:14+00:00 2026-06-14T07:01:14+00:00

Before I run this program I have 0 errors or warnings. But when I

  • 0

Before I run this program I have 0 errors or warnings. But when I run it the output I am getting is (lldb) and XCode highlights my NSLog output and says Thread 1 Breakpoint 1? My first question is why am I not getting any output, and how can I fix what I have to get output? And my second question is how can I break up each one of these parts and put them into their own class. So not have them all in main.m. This is my first day coding in XCode coming from Java so I’m still learning this language. Thank you.

Part 1

#import <Foundation/Foundation.h>

@interface Person : NSObject
{
    NSString * name;
    int age;
    int weight;
}
    /***************************************
     * MUTATORS FOR PERSON INTERFACE
     ***************************************/
    - (void) setName : (NSString *) n;
    - (void) setAge : (int) a;
    - (void) setWeight : (int) w;


    /***************************************
    * MUTATORS FOR PERSON INTERFACE
    ***************************************/
    -(NSString *) getName;
    -(int) getAge;
    - (int) getWeight;
@end

Part 2

@implementation Person
    /***************************************
     * MUTATORS FOR PERSON IMPLEMENTATION
     ***************************************/
    -(void) setName:(NSString *) n
    {
        name = n;
    }
    -(void) setAge:(int) a
    {
        age = a;
    }
    -(void) setWeight:(int)w
    {
        weight = w;
    }



    /**********************************
     * ACCESSORS FOR PERSON IMPLEMENTATION
     **********************************/
    -(NSString *) getName
    {
        return name;
    }
    -(int) getAge
    {
        return age;
    }
    -(int) getWeight
    {
        return weight;
    }
@end

Part 3 This is where I have the problem. It doesen’t like NSLog

int main (int argc, const char * argv[])
{
    @autoreleasepool
    {
        Person *p1 = [[Person alloc]init];

        [p1 setName: @"Chris"];
        [p1 setAge:18];
        [p1 setWeight:200];

        NSLog(@"\nName: %@ \nAge: %i \nWeight: %i", p1.getName, p1.getAge, p1.getWeight);
    }

    return 0;
}
  • 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-14T07:01:15+00:00Added an answer on June 14, 2026 at 7:01 am

    When using NSLog, %@ is used for logging objects, but those methods return int (a primitive type). Replace them with %d (string formatting for Decimal int) and that line should stop crashing.

    To split them up, simply create new .m and .h files. XCode should be able to help you with this process. The .m files will automatically be compiled, and .h files should (generally speaking) be included by any file that needs information about the class it refers to. So Part 1 would be Person.h, Part 2 would be Person.h (and include the line @import Person.h, and Part 3 would remain in main.m.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have run this program before and it worked fine. Then I added the
I'm really suprised I haven't run into this problem before, but it seems that
I'm trying to execute this code nmea2kml.cpp but I keep getting the following errors.
Has anyone ever run into this issue before? Sometimes the string displays, sometimes half
I've run into this problems several times before when trying to do some html
I'm hoping someone has run into this sort of problem before, and can give
Before the switch and in all apps on this passenger that run rails 2.0
If I run the function below before defining it, I will get this error...
Before you run off and google, I have read lots of articles, posts, and
I have a WPF C# application here, finally have solved errors. But after I

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.