Re: NSMutableArray is null?
Re: NSMutableArray is null?
- Subject: Re: NSMutableArray is null?
- From: Pierce Freeman <email@hidden>
- Date: Tue, 31 Mar 2009 20:11:26 -0700
- Thread-topic: NSMutableArray is null?
Thanks Roland, I probably shouldn't - It was just such a beginner's mistake.
;) And as for your mistake, I probably wouldn't have gotten that ever
figured out.
On 3/31/09 7:45 PM, "Roland King" <email@hidden> wrote:
> don't beat yourself up too much.
>
> I spent 30 minutes last night staring at this line of code and trying to
> figure out why it wouldn't compile. Checked headers, checked libraries,
> checked the definition of the function sin(). Pulled out hair by the
> handful, restarted XCode .. when it finally dawned on me I decided it
> was time to go to bed ..
>
> double sin = sin( angle );
>
> Pierce Freeman wrote:
>> Ken:
>>
>> Note to self, don't go writing to support boards when I am already half
>> asleep. ;) I realize that now, and I understand what instance variables
>> are, just I couldn't think of the name when I was writing my original post.
>> And in my instance variable programming, I forgot that you have to run this
>> no matter if it is an instance variable or not:
>>
>> globalVariable = [[NSMutableArray alloc] init];
>>
>>
>> On 3/31/09 7:19 PM, "Ken Thomases" <email@hidden> wrote:
>>
>>
>>> On Mar 31, 2009, at 9:12 PM, Pierce Freeman wrote:
>>>
>>>
>>>> Whoops, sorry I didn't put that in...
>>>>
>>>> @interface Example_Class : NSObject {
>>>>
>>>> IBOutlet NSTableView *tableView;
>>>> NSMutableArray *globalVariable;
>>>> }
>>>
>>> That's not a global variable. It's an instance variable. That's a
>>> massive conceptual error, and you should do your best to understand
>>> why you made it before going much further. Perhaps reading Apple's
>>> guide to Object-Oriented Programming with Objective-C would help:
>>>
>>>
http://developer.apple.com/documentation/Cocoa/Conceptual/OOP_ObjC/index.htm>>>
l
>>>
>>> Next, what you showed is the declaration of the variable. The
>>> variable is a pointer, which may point to an object. Declaring a
>>> pointer does not allocate or initialize the object, nor make the
>>> pointer point to the object (or anything in particular). You have to
>>> do that separately.
>>>
>>> Regards,
>>> Ken
>>>
>>
>>
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden