NSTimer Question (Crash when it fires)
NSTimer Question (Crash when it fires)
- Subject: NSTimer Question (Crash when it fires)
- From: Bert Torfs <email@hidden>
- Date: Thu, 2 Dec 2004 21:59:29 +0100
<x-tad-smaller>Dear all,
following method runs OK if I call it directly from my code. When I call it via an NSTimer however, my program crashes when getting the arrangedObjects from the 'theStockArrayController'.
//=======Snippet start
-(</x-tad-smaller><x-tad-smaller>void</x-tad-smaller><x-tad-smaller>)calculateStockPrices:(NSTimer*)theTimer
{
NSArray* theCurrencyArray;
</x-tad-smaller><x-tad-smaller>//theStockArrayController is an IBOutlet connected via Interface builder</x-tad-smaller><x-tad-smaller>
</x-tad-smaller><x-tad-smaller>//to a standard arrayController. We need to loop over the array it controls</x-tad-smaller><x-tad-smaller>
</x-tad-smaller><x-tad-smaller>if</x-tad-smaller><x-tad-smaller> (theStockArrayController)
{
//This crashes if called from a timer
theCurrencyArray = [theStockArrayController arrangedObjects];
//The rest is of no importance
}
}
//=======Snippet end
The timer is created with the following statement :
theRefreshTimer = [[NSTimer scheduledTimerWithTimeInterval:(NSTimeInterval)theRefreshRate*</x-tad-smaller><x-tad-smaller>60</x-tad-smaller><x-tad-smaller>
target:</x-tad-smaller><x-tad-smaller>self</x-tad-smaller><x-tad-smaller>
selector:</x-tad-smaller><x-tad-smaller>@selector</x-tad-smaller><x-tad-smaller>(calculateStockPrices:)
userInfo:</x-tad-smaller><x-tad-smaller>NULL</x-tad-smaller><x-tad-smaller>
repeats:</x-tad-smaller><x-tad-smaller>YES</x-tad-smaller><x-tad-smaller>]retain];
any idea?
Thanks a lot,
Bert
</x-tad-smaller> _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden