Skip to content

Commit a7c4a03

Browse files
committed
WKWebView example only available on iOS 8 devices
1 parent 59d4f19 commit a7c4a03

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

Example Apps/ExampleApp-iOS.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
0E4E9D4C1A101E0B00043087 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E8082DC19EDD98700479452 /* WebKit.framework */; };
1011
0E50601C1A01B442000BEEEA /* WebViewJavascriptBridgeBase.m in Sources */ = {isa = PBXBuildFile; fileRef = 0E50601B1A01B442000BEEEA /* WebViewJavascriptBridgeBase.m */; };
1112
0E8082DB19EDC32300479452 /* WKWebViewJavascriptBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 0E8082DA19EDC32300479452 /* WKWebViewJavascriptBridge.m */; };
1213
0ECB01441A0EE1F20037FF4E /* ExampleWKWebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0ECB01431A0EE1F20037FF4E /* ExampleWKWebViewController.m */; };
@@ -55,6 +56,7 @@
5556
isa = PBXFrameworksBuildPhase;
5657
buildActionMask = 2147483647;
5758
files = (
59+
0E4E9D4C1A101E0B00043087 /* WebKit.framework in Frameworks */,
5860
2CEB3EC01602563600548120 /* UIKit.framework in Frameworks */,
5961
2CEB3EC21602563600548120 /* Foundation.framework in Frameworks */,
6062
2CEB3EC41602563600548120 /* CoreGraphics.framework in Frameworks */,
@@ -278,6 +280,7 @@
278280
GCC_PRECOMPILE_PREFIX_HEADER = YES;
279281
GCC_PREFIX_HEADER = "ExampleApp-iOS/ExampleApp-iOS-Prefix.pch";
280282
INFOPLIST_FILE = "ExampleApp-iOS/ExampleApp-iOS-Info.plist";
283+
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
281284
PRODUCT_NAME = "ExampleApp-iOS";
282285
WRAPPER_EXTENSION = app;
283286
};
@@ -289,6 +292,7 @@
289292
GCC_PRECOMPILE_PREFIX_HEADER = YES;
290293
GCC_PREFIX_HEADER = "ExampleApp-iOS/ExampleApp-iOS-Prefix.pch";
291294
INFOPLIST_FILE = "ExampleApp-iOS/ExampleApp-iOS-Info.plist";
295+
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
292296
PRODUCT_NAME = "ExampleApp-iOS";
293297
WRAPPER_EXTENSION = app;
294298
};

Example Apps/ExampleApp-iOS/ExampleAppDelegate.m

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,21 @@ @implementation ExampleAppDelegate
66

77
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
88

9+
// 1. Create the UIWebView example
910
ExampleUIWebViewController* UIWebViewExampleController = [[ExampleUIWebViewController alloc] init];
1011
UIWebViewExampleController.tabBarItem.title = @"UIWebView";
11-
12-
ExampleWKWebViewController* WKWebViewExampleController = [[ExampleWKWebViewController alloc] init];
13-
WKWebViewExampleController.tabBarItem.title = @"WKWebView";
14-
12+
13+
// 2. Create the tab footer and add the UIWebView example
1514
UITabBarController *tabBarController = [[UITabBarController alloc] init];
1615
[tabBarController addChildViewController:UIWebViewExampleController];
17-
[tabBarController addChildViewController:WKWebViewExampleController];
18-
19-
2016

17+
// 3. Create the WKWebView example for devices >= iOS 8
18+
if([WKWebView class]) {
19+
ExampleWKWebViewController* WKWebViewExampleController = [[ExampleWKWebViewController alloc] init];
20+
WKWebViewExampleController.tabBarItem.title = @"WKWebView";
21+
[tabBarController addChildViewController:WKWebViewExampleController];
22+
}
23+
2124
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
2225
self.window.rootViewController = tabBarController;
2326
[self.window makeKeyAndVisible];

0 commit comments

Comments
 (0)