Re: NSLog format
Re: NSLog format
- Subject: Re: NSLog format
- From: Denis Stanton <email@hidden>
- Date: Sun, 2 Feb 2003 15:22:57 +1300
Thank you for your reply Steven
On Sunday, February 2, 2003, at 02:18 PM, Steven M.Palm wrote:
On Saturday, February 1, 2003, at 06:47 PM, Denis Stanton wrote:
NSString *myLabel = [(Block *)[blocks objectAtIndex: index]
lab];
NSLog( myLabel );
It was my understanding that in a case like this, when you pass in
an object, NSLog calls it's descriptionWithLocale: or description:
method.
For the question on what the format string to NSLog() can be:
http://developer.apple.com/techpubs/macosx/Cocoa/TasksAndConcepts/
ProgrammingTopics/DataFormatting/Tasks/FormatStrings.html
This link leads to the topic "Using Format Strings" which contains one
of the strangest sentences I have ever seen in a computer manual - or
perhaps anywhere.
Quote: "This typecasting doesn't occur with NSString's formatting
methods, so be sure to cast yourthods, so be sure to casthods, so be
sure thods,thods, so be values explicitly. "
Clear as mud, really :-)
Apart from that strange bit of editing, my difficulty is that the
documentation assumes that the reader can already speak C. I have many
years of Cobol (a long time ago in a land far away), a year or two of
Java recently, and in between some acquaintance with Fortran, basic,
Snobol, Lisp, RPG and Algol, but no C, so promises of "support for
printf()-style format specifiers" leave me none the wiser.
NSLog(@"person = %@", person);
seems to work, where person is defined elsewhere to be of type
ABPPerson
but
NSString *property = [(Block *)[ blocks objectAtIndex: index] prop];
NSLog(@"property = %@", property);
prints
property = (null)
Maybe it's true that the string "property" contains null, or maybe the
construction
NSLog(@"property = %@", property);
is not good enough for an NSString.
Denis
_______________________________________________
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.