• 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: NSLog() what is it?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSLog() what is it?


  • Subject: Re: NSLog() what is it?
  • From: Vince DeMarco <email@hidden>
  • Date: Sat, 22 Jun 2002 18:18:36 -0700

On Friday, June 21, 2002, at 11:55 PM, Michael Zornek wrote:

Hi everyone! First post to the list!

I'm in ch 6 of Learning Cocoa (where we are building Cocoa Foundation Tools)
and it tells me to use NSLog all over the place but when I went to option
click it for documentation it wasn't there. After some more directed
searching I couldn't find it ether.


Look here

file:///System/Library/Frameworks/Foundation.framework/Versions/C/ Resources/English.lproj/Documentation/Reference/ObjC_classic/Functions/ FoundationFunctions.html
(search for NSLog)

My main is below, and here are my questions:

1) Is NSLog() an object? If so, why does option clicking it not return
information?

Its a function

2) Where is info. In particular the book tells us to use the following line
to get the value inside of an array:

NSLog(@"Array desctiption: %@ items.\n", myArray);

But when I try to out my "itemcount" in a similar fashion:

NSLog(@itemcount);
-or-
NSLog(itemCount);

It get errors :-(

I think in general I'm looking to replicate something similar to this C++
code that I've been writing.

cout << "The number of items in my array are: " << itemCount << endl;

thanks in adv. for all your help,
~ Mike, a lowely web guy working his way into platform coding.

My main:

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[]) {

// init
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSMutableArray *myArray;
NSString *myString;
int itemCount;

// start code
NSLog(@"Hello, World!");

myArray = [[NSMutableArray alloc] init];

NSLog(@"Array desctiption: %@ items.\n", myArray);

[myArray addObject: @"Here's a string!"];
[myArray addObject: @"Here's a another string!"];

NSLog(@"Array desctiption: %@ items.\n", myArray);

itemCount = [myArray count];

// NSLog(@itemcount);

// NSLog(itemCount);

[myArray release];

[pool release];
return 0;
}

--
Mike Zornek | Project Leader
Apple Student Developers
The Insanely Great Site with the Insanely Long URL
http://www.applestudentdevelopers.org

Personal Site:
http://www.mikezornek.com
_______________________________________________
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.
_______________________________________________
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.

References: 
 >NSLog() what is it? (From: Michael Zornek <email@hidden>)

  • Prev by Date: Re: Document name changed notification?
  • Next by Date: Re: Using Darwin headers
  • Previous by thread: Learning Cocoa / Cocoa Programming for Mac OS X - comments
  • Next by thread: Re: NSLog() what is it?
  • Index(es):
    • Date
    • Thread