From ed7276166a1390f0a73cc1e66b280338973506e3 Mon Sep 17 00:00:00 2001 From: Maximilian Szengel Date: Tue, 12 Mar 2013 11:05:14 +0100 Subject: [PATCH] Fix compile errors with Xcode 4.6. The compiler fails to understand the typeof (self) syntax: FPPopover/FPPopoverController.m:124:17: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] __block typeof (self) bself = self; ~~~~~~~ ^ FPPopover/FPPopoverController.m:124:25: error: a parameter list without types is only allowed in a function definition __block typeof (self) bself = self; ^ FPPopover/FPPopoverController.m:124:30: error: expected ';' at end of declaration __block typeof (self) bself = self; I fixed this by following the advice found at http://stackoverflow.com/a/10921206/1147607 --- ARCMacros.h | 3 ++- FPPopoverController.m | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ARCMacros.h b/ARCMacros.h index 166d72d..77e3ee9 100644 --- a/ARCMacros.h +++ b/ARCMacros.h @@ -59,4 +59,5 @@ #define SAFE_ARC_AUTORELEASE_POOL_END() [pool release]; #endif - +#define FPPopoverWeakObject(o) __block __typeof__((__typeof__(o))o) +#define FPPopoverWeakSelf FPPopoverWeakObject(self) \ No newline at end of file diff --git a/FPPopoverController.m b/FPPopoverController.m index 18369ce..33dccdd 100644 --- a/FPPopoverController.m +++ b/FPPopoverController.m @@ -120,8 +120,7 @@ -(id)initWithViewController:(UIViewController*)viewController _touchView.clipsToBounds = NO; [self.view addSubview:_touchView]; - - __block typeof (self) bself = self; + FPPopoverWeakSelf bself = self; [_touchView setTouchedOutsideBlock:^{ [bself dismissPopoverAnimated:YES]; }];