Re: NSOpenPanel
Re: NSOpenPanel
- Subject: Re: NSOpenPanel
- From: Chris Hanson <email@hidden>
- Date: Fri, 3 Oct 2003 12:44:20 -0500
On Friday, October 3, 2003, at 10:52 AM, Malcolm Sharman wrote:
NSLog(@"*** %@ items in array ***", [files count]);
I'm just confused as to why accessing the count method of NSArray would
crash when I just initalised it. Any ideas?
First off, a terminology nit: You're not "accessing the count method
of NSArray," you're sending an NSArray the -count message. The
programmer sends messages, the runtime invokes methods.
Secondly, you're using the %@ construct and passing it an integer
argument. %@ means "interpret the corresponding argument as an object,
and print the result of sending it the -description message." Since
the result of sending -count to an NSArray is an int, which isn't an
object, that's why you're seeing a crash. Just use %d instead.
-- Chris
--
Chris Hanson, bDistributed.com, Inc. | Email: email@hidden
Custom Mac OS X Development | Phone: +1-847-372-3955
http://bdistributed.com/ | Fax: +1-847-589-3738
http://bdistributed.com/Articles/ | Personal Email: email@hidden
_______________________________________________
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: | |
| >NSOpenPanel (From: Malcolm Sharman <email@hidden>) |