FROM : David Duncan
DATE : Tue Apr 22 23:15:05 2008
On Apr 22, 2008, at 2:03 PM, Peter Browne wrote:
> I'm returning to Cocoa after quite a long break, and it seems that
> I'm a little rusty...
>
> All I want to do is find out the number of items in an NSArray and
> store that as a variable, which I can then find the square root of.
>
> The docs tell me that [NSArray count] returns an NSUInteger, but
> exactly WHAT one of these is, or how I use it is baffling me.
An NSUInteger is just an integer that is 32-bits or 64-bits depending
on if your application is compiled for 32-bit or 64-bit.
> a simple
>
> int i = [myArray count];
>
> crashes out, and I've tried various other types of variable to no
> avail. Any thoughts? Am I missing something blindingly obvious here?
Are you getting an exception? perhaps myArray isn't really an NSArray
at the time that you are sending it the -count message?
--
David Duncan
Apple DTS Animation and Printing
david.<email_removed>
DATE : Tue Apr 22 23:15:05 2008
On Apr 22, 2008, at 2:03 PM, Peter Browne wrote:
> I'm returning to Cocoa after quite a long break, and it seems that
> I'm a little rusty...
>
> All I want to do is find out the number of items in an NSArray and
> store that as a variable, which I can then find the square root of.
>
> The docs tell me that [NSArray count] returns an NSUInteger, but
> exactly WHAT one of these is, or how I use it is baffling me.
An NSUInteger is just an integer that is 32-bits or 64-bits depending
on if your application is compiled for 32-bit or 64-bit.
> a simple
>
> int i = [myArray count];
>
> crashes out, and I've tried various other types of variable to no
> avail. Any thoughts? Am I missing something blindingly obvious here?
Are you getting an exception? perhaps myArray isn't really an NSArray
at the time that you are sending it the -count message?
--
David Duncan
Apple DTS Animation and Printing
david.<email_removed>
| Related mails | Author | Date |
|---|---|---|
| Peter Browne | Apr 22, 23:03 | |
| Shawn Erickson | Apr 22, 23:10 | |
| Shawn Erickson | Apr 22, 23:14 | |
| David Duncan | Apr 22, 23:15 | |
| Andy Lee | Apr 22, 23:19 | |
| Peter Browne | Apr 22, 23:45 | |
| Hamish Allan | Apr 22, 23:57 | |
| Shawn Erickson | Apr 23, 00:04 | |
| David Duncan | Apr 23, 01:08 |






Cocoa mail archive

