From f0fc85020f335f7c967798f09470a5e01e27045b Mon Sep 17 00:00:00 2001 From: Alvise Susmel Date: Thu, 4 Apr 2013 13:39:57 +0100 Subject: [PATCH] fixed problem with cocoapods arc projects --- FPPopoverController.h | 2 +- FPPopoverController.m | 9 +++++---- FPTouchView.m | 11 ++--------- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/FPPopoverController.h b/FPPopoverController.h index 7f75959..9eda7c1 100644 --- a/FPPopoverController.h +++ b/FPPopoverController.h @@ -28,7 +28,7 @@ //ARC-enable and disable support #if __has_feature(objc_arc) - @property(nonatomic,weak) id delegate; + @property(nonatomic,assign) id delegate; #else @property(nonatomic,assign) id delegate; #endif diff --git a/FPPopoverController.m b/FPPopoverController.m index 0896901..e9943c4 100644 --- a/FPPopoverController.m +++ b/FPPopoverController.m @@ -84,7 +84,6 @@ -(void)dealloc { [self removeObservers]; if(_shadowColor) CGColorRelease(_shadowColor); -#define FP_DEBUG #ifdef FP_DEBUG NSLog(@"FPPopoverController dealloc"); @@ -125,11 +124,12 @@ -(id)initWithViewController:(UIViewController*)viewController #if __has_feature(objc_arc) //ARC on - __weak typeof (self)bself = self; + id bself = self; #else //ARC off - __block typeof (self) bself = self; + __block id bself = self; #endif + [_touchView setTouchedOutsideBlock:^{ [bself dismissPopoverAnimated:YES]; }]; @@ -307,7 +307,8 @@ -(CGPoint)originFromView:(UIView*)fromView -(void)presentPopoverFromView:(UIView*)fromView { - _fromView = fromView; + SAFE_ARC_RELEASE(_fromView); + _fromView = SAFE_ARC_RETAIN(fromView); [self presentPopoverFromPoint:[self originFromView:_fromView]]; } diff --git a/FPTouchView.m b/FPTouchView.m index a5f34b9..cc7bee4 100644 --- a/FPTouchView.m +++ b/FPTouchView.m @@ -24,21 +24,14 @@ -(void)dealloc -(void)setTouchedOutsideBlock:(FPTouchedOutsideBlock)outsideBlock { -#if __has_feature(objc_arc) - _outsideBlock = outsideBlock; -#else + SAFE_ARC_RELEASE(_outsideBlock); _outsideBlock = [outsideBlock copy]; -#endif } -(void)setTouchedInsideBlock:(FPTouchedInsideBlock)insideBlock { -#if __has_feature(objc_arc) - _insideBlock = insideBlock; -#else + SAFE_ARC_RELEASE(_insideBlock); _insideBlock = [insideBlock copy]; -#endif - } -(UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event