Re: NSDate scope
Re: NSDate scope
- Subject: Re: NSDate scope
- From: Kyle Sluder <email@hidden>
- Date: Sun, 21 Jun 2009 14:09:07 -0700
On Sat, Jun 20, 2009 at 4:52 PM, John Baldwin<email@hidden> wrote:
> I declared a (NSDate *) in my .h file.
Where? Inside an @implementation, or as a global variable? If it's a
global variable, you are aware that for every translation unit that
imports your header, you will wind up with a different variable?
> Then in my init method, I initialized it to the current date. I tried
> various methods, all with the same result:
You're mixing owning methods (alloc, retain) with non-owning methods
(+date). This indicates that you do not understand Cocoa memory
management.
> Then, in a method that was called by an NSTimer object, I tried to use that
> date as a reference point. But the debugger showed the variable as "out of
> scope."
Where is this method defined? What object was it being invoked on?
Sounds like you need to do a bit of reading. If you go through the
conceptual docs and still have trouble understanding, post your code
here and we can help you out a bit.
--Kyle Sluder
_______________________________________________
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: | |
| >NSDate scope (From: John Baldwin <email@hidden>) |