Skip to content

Commit 2b4a68c

Browse files
committed
Fix marcuswestin#45: Use __has_feature for arc weak support
1 parent 090fc95 commit 2b4a68c

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

WebViewJavascriptBridge/WebViewJavascriptBridge.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@
1212
#define kCustomProtocolScheme @"wvjbscheme"
1313
#define kQueueHasMessage @"__WVJB_QUEUE_MESSAGE__"
1414

15-
#if TARGET_OS_IPHONE && defined(__IPHONE_5_0) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_5_0)
16-
#define WVJB_WEAK_FALLBACK weak
17-
#elif TARGET_OS_MAC && defined(__MAC_10_7) && (__MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_7)
18-
#define WVJB_WEAK_FALLBACK weak
19-
#else
20-
#define WVJB_WEAK_FALLBACK unsafe_unretained
21-
#endif
22-
2315
#if defined __MAC_OS_X_VERSION_MAX_ALLOWED
2416
#import <WebKit/WebKit.h>
2517
#define WVJB_PLATFORM_OSX

WebViewJavascriptBridge/WebViewJavascriptBridge.m

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@
88

99
#import "WebViewJavascriptBridge.h"
1010

11+
#if __has_feature(objc_arc_weak)
12+
#define WVJB_WEAK __weak
13+
#else
14+
#define WVJB_WEAK __unsafe_unretained
15+
#endif
16+
17+
1118
@implementation WebViewJavascriptBridge {
12-
__weak WVJB_WEBVIEW_TYPE* _webView;
13-
__weak id _webViewDelegate;
19+
WVJB_WEAK WVJB_WEBVIEW_TYPE* _webView;
20+
WVJB_WEAK id _webViewDelegate;
1421
NSMutableArray* _startupMessageQueue;
1522
NSMutableDictionary* _responseCallbacks;
1623
NSMutableDictionary* _messageHandlers;

0 commit comments

Comments
 (0)