diff --git a/NSTimer+Blocks.m b/NSTimer+Blocks.m index 18eadc3..b7df0d8 100644 --- a/NSTimer+Blocks.m +++ b/NSTimer+Blocks.m @@ -11,12 +11,18 @@ @implementation NSTimer (Blocks) +(id)scheduledTimerWithTimeInterval:(NSTimeInterval)inTimeInterval block:(void (^)())inBlock repeats:(BOOL)inRepeats { - return [self scheduledTimerWithTimeInterval:inTimeInterval target:self selector:@selector(jdExecuteSimpleBlock:) userInfo:[inBlock copy] repeats:inRepeats]; + void (^block)() = [inBlock copy]; + id ret = [self scheduledTimerWithTimeInterval:inTimeInterval target:self selector:@selector(jdExecuteSimpleBlock:) userInfo:block repeats:inRepeats]; + [block release]; + return ret; } +(id)timerWithTimeInterval:(NSTimeInterval)inTimeInterval block:(void (^)())inBlock repeats:(BOOL)inRepeats { - return [self timerWithTimeInterval:inTimeInterval target:self selector:@selector(jdExecuteSimpleBlock:) userInfo:[inBlock copy] repeats:inRepeats]; + void (^block)() = [inBlock copy]; + id ret = [self timerWithTimeInterval:inTimeInterval target:self selector:@selector(jdExecuteSimpleBlock:) userInfo:block repeats:inRepeats]; + [block release]; + return ret; } +(void)jdExecuteSimpleBlock:(NSTimer *)inTimer;