• 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: NSOutlineView problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOutlineView problem


  • Subject: Re: NSOutlineView problem
  • From: Andrew Farmer <email@hidden>
  • Date: Wed, 23 Jan 2008 02:49:32 -0800

I'm sorry if the following seems harsh, but it seems as though you're jumping into writing a Cocoa application without an adequate understanding of the framework and its associated conventions.

On 23 Jan 08, at 02:23, peiyuan wrote:
I am now writeing a very simple example for NSOutlineView. I have already searched the mailing list. I follow the guide to do the example but failed.

Which guide, which example?

<snip>

NSArray *myArray;
device device1,device2,device3,device4,device5;
machine mach1, mach2;

These should almost certainly be instance variables, not globals.

Also, this won't compile as written, as device and machine (which should both be capitalized) are classes. Is there some sort of bizarre typedef you've left out, or does your message not accurately reflect the code you're running?

- (id) init {
self = [super init];
if (self != nil) {

 [device1 retain];
 [device2 retain];
 [device3 retain];
 [device4 retain];
 [device5 retain];
 [mach1 retain];
 [mach2 retain];

What, exactly, are you retaining here? You haven't even allocated these objects yet.


device1 = [[device init] alloc];

The correct invocation is [[ClassName alloc] init], not the other way around. I would be very surprised if this didn't throw a fatal error at runtime.


<snip, more of the same...>

What is "NSDocumentControllerMoreIVars"? I think this should be "[myDevice count]". So, what happened? What did I do wrong?

There is almost certainly something wrong with your memory management.

Another question is that when should I use [xxxx retain], [xxxxx copy] and [xxxx release].


http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html
_______________________________________________

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


References: 
 >NSOutlineView problem (From: "peiyuan" <email@hidden>)

  • Prev by Date: Re: Sizing window question
  • Next by Date: Re: AW: leopard: No universal libjpeg.dylib in 10.4SDK?
  • Previous by thread: NSOutlineView problem
  • Next by thread: Re: NSOutlineView problem
  • Index(es):
    • Date
    • Thread