From 2231d608e6c0071369317df000fe24683107de59 Mon Sep 17 00:00:00 2001 From: Yang Meyer Date: Mon, 29 Oct 2012 15:59:12 +0100 Subject: [PATCH 1/2] Made iOS 6-compatible. Beginning in iOS 6, dispatch_source_t are Obj-C objects and thus handled by ARC. See http://stackoverflow.com/questions/8618632/does-arc-support-dispatch-queues --- RNTimer/RNTimer.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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; From db5a0db35797dc1b46b62bcb726f28629996f25e Mon Sep 17 00:00:00 2001 From: Yang Meyer Date: Mon, 29 Oct 2012 16:01:29 +0100 Subject: [PATCH 2/2] Add ARC requirement to Readme. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) 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