• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CFShow in Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CFShow in Cocoa


  • Subject: Re: CFShow in Cocoa
  • From: Prachi Gauriar <email@hidden>
  • Date: Wed, 12 May 2004 14:27:58 -0500

On May 12, 2004, at 1:03 PM, Bob Ippolito wrote:
On May 12, 2004, at 5:59 AM, Stiphane Sudre wrote:
On 12 mai 2004, at 00:29, Mark Thomas wrote:

The results differ whether you use:

NSLog(myDictionary);

Which is incorrect unless myDictionary is a NSString*. RTFM :)

or

NSLog(@"%@",[myDictionary description]);

NSLog(@"%@", myDictionary) is all you need, the description is implicit.


That's what the documentation says, but it's not quite the case. This code

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:@"Object 1", @"Key 1",
@"Object 2", @"Key 2", @"Object 3", @"Key 3", @"Object 4", @"Key 4", @"Object 5", @"Key 5", nil];

NSLog(@"%@", dictionary);
NSLog(@"%@", [dictionary description]);

[pool release];
return 0;
}

results in this output

2004-05-12 14:25:52.684 test[2781] <CFDictionary 0x305ab0 [0xa01900e0]>{type = immutable, count = 5, capacity = 5, pairs = (
0 : Key 2 = Object 2
1 : Key 3 = Object 3
2 : Key 4 = Object 4
3 : Key 5 = Object 5
10 : Key 1 = Object 1
)}
2004-05-12 14:25:52.723 test[2781] {
"Key 1" = "Object 1";
"Key 2" = "Object 2";
"Key 3" = "Object 3";
"Key 4" = "Object 4";
"Key 5" = "Object 5";
}

-Prachi
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: CFShow in Cocoa
      • From: Finlay Dobbie <email@hidden>
References: 
 >Re: CFShow in Cocoa (From: Mark Thomas <email@hidden>)
 >Re: CFShow in Cocoa (From: Stéphane Sudre <email@hidden>)
 >Re: CFShow in Cocoa (From: Bob Ippolito <email@hidden>)

  • Prev by Date: [JOB OPENING] Cocoa Developer Needed
  • Next by Date: Inserting objects in content array
  • Previous by thread: Re: CFShow in Cocoa
  • Next by thread: Re: CFShow in Cocoa
  • Index(es):
    • Date
    • Thread