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

The Archive Base Latest Questions

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

I have an object (TCLesson), maintaining collection of other objects (TCQuestion). Description impolementation for

  • 0

I have an object (TCLesson), maintaining collection of other objects (TCQuestion).

Description impolementation for the outer is like:

-(NSString*)description
{
    return [NSString stringWithFormat:
            @"TCLesson \n"
            "welcomeMessages: \n%@ \n"
            "questionPhrases: \n%@ \n"
            "goodAnswerAcknowledgements: \n%@ \n"
            "wrongAnswerAcknowledgements: \n%@ \n"
            "questions: \n%@ \n",
            self.welcomeMessages,
            self.questionPhrases,
            self.goodAnswerAcknowledgements,
            self.wrongAnswerAcknowledgements,
            self.questions];
}

Pretty the same for the inner objects, like:

-(NSString*)description
{
    return [NSString stringWithFormat:
            @"TCQuestions \n"
            "question: \n%@ \n"
            "pictureFileName: \n%@ \n"
            "answers: \n%@ \n"
            "hints: \n%@ \n",
            self.question,
            self.pictureFileName,
            self.answers,
            self.hints];
}

But when it comes to logging, the inner object’s description goes wild, and prints out some weird formatting characters, like:

TCLesson 
welcomeMessages: 
(
    "Hi <USERNAME>, let's learn the colors!",
    "Hi <USERNAME>, let's get into this lesson about the colors!",
    "Yay! We gonna learning about the colors, <USERNAME>!"
) 
questionPhrases: 
(
    "What color is this?",
    "What is the name of this color?",
    "What color do you see on the picture?"
) 
goodAnswerAcknowledgements: 
(
    "Yay! Exactly, <USERNAME>. This color is <ANSWER>.",
    "As you said, this color is <ANSWER>.",
    "Woot! Yes, you can see <ANSWER> on the picture."
) 
wrongAnswerAcknowledgements: 
(
    "No, but I can help you.",
    "Wrong answer, but I'm here to help.",
    "Apperantly not, here is a little help."
) 
questions: 
(
    "TCQuestions \nquestion: \n<DEFAULT> \npictureFileName: \norange.jpg \nanswers: \n(\n    ORANGE,\n    GOLD\n) \nhints: \n(\n    \"It is the color of the pumpkin.\",\n    \"It is the color of the orange.\",\n    \"It is the color of the carrot.\"\n) \n",
    "TCQuestions \nquestion: \n<DEFAULT> \npictureFileName: \nyellow.jpg \nanswers: \n(\n    YELLOW,\n    AMBER,\n    LEMON\n) \nhints: \n(\n    \"It is the color of the sun.\",\n    \"It is the color of the banana.\",\n    \"It is the color of the corn.\"\n) \n"
) 

I’d be very pleased, if I could read the correct syntax there.

What to do now?

  • 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-17T20:11:48+00:00Added an answer on June 17, 2026 at 8:11 pm

    As you have array of TCQuestion object in TCLesson object, when description method of TCLesson is called internally description method of NSArray will get called for questions property which again internally calls description method of TCQuestion. During this, NSArray’s description method is formatting(replacing “\n” with “\n”) description of TCQuestion.

    So you need to replace occurrence of “\\n” with “\n” in description method of TCLesson before returning string.

    -(NSString*)description
    {
        return [[NSString stringWithFormat:
                @"TCLesson \n"
                "welcomeMessages: \n%@ \n"
                "questionPhrases: \n%@ \n"
                "goodAnswerAcknowledgements: \n%@ \n"
                "wrongAnswerAcknowledgements: \n%@ \n"
                "questions: \n%@ \n",
                self.welcomeMessages,
                self.questionPhrases,
                self.goodAnswerAcknowledgements,
                self.wrongAnswerAcknowledgements,
                self.questions] stringByReplacingOccurrencesOfString:@"\\n" withString:@"\n"];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an object that holds several value types and other objects. I want
Suppose I have a design like this: Object GUI has two objects: object aManager
I have an object Document with nested Properties (Name, Value) collection. Now I want
i have object like this: some_object this object has like 1000 properties. i would
In C# you have object initializers to initialize fields of objects at creation time
I have object properties in my code that look like this: $obj ->field_name_cars[0]; $obj
Application use NHibernate. I Have object A that contains set of objects B. I
I'am using key-value observing. I have object_1 (NSManagedObject) and few other objects-observers. When I
I have an object, and I am using php's session to persist the objects
I have object A which contains multiple instances of object B, which in turn

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.