Skip navigation.
 
mlNSTimer Question (Crash when it fires)
FROM : Bert Torfs
DATE : Thu Dec 02 21:59:29 2004

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
-(void)calculateStockPrices:(NSTimer*)theTimer
{
   NSArray*    theCurrencyArray;
   //theStockArrayController is an IBOutlet connected via Interface
builder
   //to a standard arrayController. We need to loop over the array it
controls
   if (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*60
                                                       target:self
                                                     selector:@selector(calculateStockPrices:)
                                                     userInfo:NULL
                                                     repeats:YES]retain];
any idea?
Thanks a lot,

Bert

Related mailsAuthorDate
mlNSTimer Question (Crash when it fires) Bert Torfs Dec 2, 21:59
mlRe: NSTimer Question (Crash when it fires) Bert Torfs Dec 3, 10:10