• 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: basic Obj-C lesson (was runtime error with NSArray no more!)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: basic Obj-C lesson (was runtime error with NSArray no more!)


  • Subject: Re: basic Obj-C lesson (was runtime error with NSArray no more!)
  • From: Mike McCune <email@hidden>
  • Date: Fri, 6 Dec 2002 13:51:29 -0500

On Friday, December 6, 2002, at 10:18 AM, Sherm Pendley wrote:
Is that the array you created with arrayWithObjects:? If so, that method returns an autoreleased object. An autoreleased object normally only exists for the lifetime of the event (in this case, the awakeFromNib: event) in which it was created.
<snip>


so are you saying that on my first iteration I should add something like [[myArray objectAtIndex: i] retain]; and then of course release it after the second iteration?

that makes a good deal of sense. man, I'm used to C and C++ I don't know how long it will take to get used to this memory management scheme. In this specific instance I'm not sure I understand how the NSButton object is created and destroyed. I mean its in my UI but you're saying that that the object is only retained as long as the call is going on? Shouldn't the pointer in my NSArray still point to the object that exists in the UI? I would love to hear the answer to this, thanks.

cool runnings,

Mike McCune
OPB Studios
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.

  • Follow-Ups:
    • RE: basic Obj-C lesson (was runtime error with NSArray no more!)
      • From: "Jonathan E. Jackel" <email@hidden>
    • Re: basic Obj-C lesson (was runtime error with NSArray no more!)
      • From: Sherm Pendley <email@hidden>
References: 
 >Re: runtime error with NSArray no more! (From: Sherm Pendley <email@hidden>)

  • Prev by Date: Re: [repost] nonModal NSWindowController
  • Next by Date: [OT] Re: newbie Perl question
  • Previous by thread: Re: runtime error with NSArray no more!
  • Next by thread: Re: basic Obj-C lesson (was runtime error with NSArray no more!)
  • Index(es):
    • Date
    • Thread