diff --git a/README.md b/README.md index 67f2912..937340a 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,10 @@ USAGE [weakSelf doSomething]; }]; +REQUIREMENTS +============ +RNTimer uses ARC. If your project doesn’t, set the `-fobjc-arc` flag for `RNTimer.m`. + BACKGROUND ========== http://robnapier.net/blog/simple-gcd-timer-rntimer-762 \ No newline at end of file diff --git a/RNTimer/RNTimer.m b/RNTimer/RNTimer.m index cc1b180..585d5b1 100644 --- a/RNTimer/RNTimer.m +++ b/RNTimer/RNTimer.m @@ -24,12 +24,12 @@ // DEALINGS IN THE SOFTWARE. // - #import "RNTimer.h" +#import @interface RNTimer () @property (nonatomic, readwrite, copy) dispatch_block_t block; -@property (nonatomic, readwrite, assign) dispatch_source_t source; +@property (nonatomic, readwrite, strong) dispatch_source_t source; @end @implementation RNTimer @@ -58,7 +58,10 @@ + (RNTimer *)repeatingTimerWithTimeInterval:(NSTimeInterval)seconds - (void)invalidate { if (self.source) { dispatch_source_cancel(self.source); + +#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0 dispatch_release(self.source); +#endif self.source = nil; } self.block = nil;