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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:04:28+00:00 2026-05-10T21:04:28+00:00

Forgive me for a potentially silly question here, but in other programming languages (scripting

  • 0

Forgive me for a potentially silly question here, but in other programming languages (scripting ones like PHP or Perl) it is often easy to dump everything contained within a variable.

For instance, in PHP there are the var_dump() or print_r() functions. Perl has the Data::Dumper CPAN class, etc etc.

Is there something like this for Objective-C? It would be very convenient in a few cases to be able to dump everything like that, instead of using gdb to inspect each variable.

  • 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. 2026-05-10T21:04:29+00:00Added an answer on May 10, 2026 at 9:04 pm

    In Cocoa, there is no ‘dump’ like PHP’s print_r or python’s repr since there is no textual format that ‘represents’ an object as in those languages. If you use

    NSLog(@'%@', myObj); 

    or

    NSString *stringRep = [NSString stringWithFormat:@'%@',myObj]; 

    or

    NSString *stringRep = [myObj description]; 

    you will get (logged to console in the first case), the result of [myObj description], a method defined in NSObject for the purpose of printing a description (not a dump) of an object.

    If you invoke po myObj in gdb, you get [myObj debugDescription] (often the same as description, but not always).

    Classes like NSArray and NSDictionary and NSData override description to print a pretty useful recursive description of their contents, but the default [NSObject description] prints only the pointer value corresponding to the instance.

    If you control the code for the types in question, you can override their description or debugDescription methods to return anything you want. If not, you could override the description or debugDescription method using a category, or use a category to define a myDebugDescription or some such that you could then invoke from gdb using po [myObj myDebugDescription].

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

Sidebar

Ask A Question

Stats

  • Questions 76k
  • Answers 76k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Thank-you folks for your help. As it turns out, the… May 11, 2026 at 3:11 pm
  • added an answer I agree with Matt's comments above. Here's a small piece… May 11, 2026 at 3:11 pm
  • added an answer What you are asking for (a css solution) is not… May 11, 2026 at 3:11 pm

Related Questions

I'd like to strip out occurrences of a specific tag, leaving the inner XML
I hope you'll forgive me for thinking that configuring a DNS server would be
Forgive me for probably using the wrong term for this application mode. Our application
In Ruby (forgive me for mentioning it's name) I noticed you could do a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.