From ad06a37191ee82582480e18ba236c507ae607e48 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 20 Sep 2016 15:41:12 +0800 Subject: [PATCH 1/5] add property 'onlyUIWebViewApplied' to make it only use UIWebView in initialization --- .../AppIcon.appiconset/Contents.json | 35 +++++++++++++++++++ ExampleProject/Podfile | 5 +-- KINWebBrowser/KINWebBrowserViewController.h | 1 + KINWebBrowser/KINWebBrowserViewController.m | 7 +++- 4 files changed, 45 insertions(+), 3 deletions(-) diff --git a/ExampleProject/KINWebBrowserExample/Images.xcassets/AppIcon.appiconset/Contents.json b/ExampleProject/KINWebBrowserExample/Images.xcassets/AppIcon.appiconset/Contents.json index b7f3352..1d060ed 100644 --- a/ExampleProject/KINWebBrowserExample/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/ExampleProject/KINWebBrowserExample/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,15 +1,35 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "29x29", "scale" : "2x" }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "40x40", "scale" : "2x" }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "60x60", @@ -20,6 +40,16 @@ "size" : "60x60", "scale" : "3x" }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, { "idiom" : "ipad", "size" : "29x29", @@ -49,6 +79,11 @@ "idiom" : "ipad", "size" : "76x76", "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" } ], "info" : { diff --git a/ExampleProject/Podfile b/ExampleProject/Podfile index 063e61b..afc7d0d 100644 --- a/ExampleProject/Podfile +++ b/ExampleProject/Podfile @@ -3,5 +3,6 @@ source 'https://github.com/CocoaPods/Specs.git' xcodeproj 'KINWebBrowserExample.xcodeproj' platform :ios, :deployment_target => '7.0' -pod 'KINWebBrowser' - +target 'KINWebBrowserExample' do + pod 'KINWebBrowser', :path => '../' +end diff --git a/KINWebBrowser/KINWebBrowserViewController.h b/KINWebBrowser/KINWebBrowserViewController.h index 64a5087..669b26e 100644 --- a/KINWebBrowser/KINWebBrowserViewController.h +++ b/KINWebBrowser/KINWebBrowserViewController.h @@ -104,6 +104,7 @@ + (UINavigationController *)navigationControllerWithWebBrowser; + (UINavigationController *)navigationControllerWithWebBrowserWithConfiguration:(WKWebViewConfiguration *)configuration NS_AVAILABLE_IOS(8_0); ++ (void)setOnlyUIWebViewApplied:(BOOL)applied; @property (nonatomic, strong) UIBarButtonItem *actionButton; @property (nonatomic, strong) UIColor *tintColor; diff --git a/KINWebBrowser/KINWebBrowserViewController.m b/KINWebBrowser/KINWebBrowserViewController.m index 253cd25..a8d5573 100644 --- a/KINWebBrowser/KINWebBrowserViewController.m +++ b/KINWebBrowser/KINWebBrowserViewController.m @@ -36,6 +36,7 @@ #import "ARChromeActivity.h" static void *KINWebBrowserContext = &KINWebBrowserContext; +static BOOL onlyUIWebViewApplied; @interface KINWebBrowserViewController () @@ -82,6 +83,10 @@ + (UINavigationController *)navigationControllerWithBrowser:(KINWebBrowserViewCo return navigationController; } ++ (void)setOnlyUIWebViewApplied:(BOOL)applied { + onlyUIWebViewApplied = applied; +} + #pragma mark - Initializers - (id)init { @@ -91,7 +96,7 @@ - (id)init { - (id)initWithConfiguration:(WKWebViewConfiguration *)configuration { self = [super init]; if(self) { - if([WKWebView class]) { + if(!onlyUIWebViewApplied && [WKWebView class]) { if(configuration) { self.wkWebView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:configuration]; } From cd98dcf0bf9755a73749ad5c383b42cd43ea5089 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 26 Sep 2016 16:55:46 +0800 Subject: [PATCH 2/5] add internal scheme 'tel' for phone call --- KINWebBrowser/KINWebBrowserViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KINWebBrowser/KINWebBrowserViewController.m b/KINWebBrowser/KINWebBrowserViewController.m index a8d5573..c8a85a5 100644 --- a/KINWebBrowser/KINWebBrowserViewController.m +++ b/KINWebBrowser/KINWebBrowserViewController.m @@ -577,7 +577,7 @@ - (void)fakeProgressTimerDidFire:(id)sender { #pragma mark - External App Support - (BOOL)externalAppRequiredToOpenURL:(NSURL *)URL { - NSSet *validSchemes = [NSSet setWithArray:@[@"http", @"https"]]; + NSSet *validSchemes = [NSSet setWithArray:@[@"http", @"https", @"tel"]]; return ![validSchemes containsObject:URL.scheme]; } From 266aa4ad181ea3beb0db24ac4adcc1ab1e1505ef Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 20 Oct 2016 14:50:02 +0800 Subject: [PATCH 3/5] adjustment for Xcode 8 --- .../project.pbxproj | 83 ++++++++++++++----- .../KINWebBrowserExample-Info.plist | 6 +- .../Launch Screen.storyboard | 48 +++++++++++ .../KINWebBrowserExampleTests-Info.plist | 2 +- 4 files changed, 117 insertions(+), 22 deletions(-) create mode 100644 ExampleProject/KINWebBrowserExample/Launch Screen.storyboard diff --git a/ExampleProject/KINWebBrowserExample.xcodeproj/project.pbxproj b/ExampleProject/KINWebBrowserExample.xcodeproj/project.pbxproj index 1d2ff60..4702ccf 100644 --- a/ExampleProject/KINWebBrowserExample.xcodeproj/project.pbxproj +++ b/ExampleProject/KINWebBrowserExample.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 0B4A989B6C1762F306885B5D /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D246F90867446D07C788DCE /* libPods.a */; }; 3BBECF2918A1E58D00A2499D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BBECF2818A1E58D00A2499D /* Foundation.framework */; }; 3BBECF2B18A1E58D00A2499D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BBECF2A18A1E58D00A2499D /* CoreGraphics.framework */; }; 3BBECF2D18A1E58D00A2499D /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BBECF2C18A1E58D00A2499D /* UIKit.framework */; }; @@ -22,6 +21,8 @@ 3BBECF4E18A1E58E00A2499D /* KINWebBrowserExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BBECF4D18A1E58E00A2499D /* KINWebBrowserExampleTests.m */; }; 3BBECF6518A1EAB100A2499D /* KINWebBrowserExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BBECF6318A1EAB100A2499D /* KINWebBrowserExampleViewController.m */; }; 3BBECF6618A1EAB100A2499D /* KINWebBrowserExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3BBECF6418A1EAB100A2499D /* KINWebBrowserExampleViewController.xib */; }; + C29E741E1DB8A02D0058C106 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C29E741D1DB8A02D0058C106 /* Launch Screen.storyboard */; }; + F513409AC812CFC9F2355928 /* libPods-KINWebBrowserExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 20A432E1AB91AADA983CEFC5 /* libPods-KINWebBrowserExample.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -35,7 +36,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 0D66287F09CB3E898333BDB8 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; + 20A432E1AB91AADA983CEFC5 /* libPods-KINWebBrowserExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-KINWebBrowserExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 3B57DAB619E11FAB00C499B5 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; 3BBECF2518A1E58D00A2499D /* KINWebBrowserExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KINWebBrowserExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 3BBECF2818A1E58D00A2499D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; @@ -56,8 +57,9 @@ 3BBECF6218A1EAB100A2499D /* KINWebBrowserExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KINWebBrowserExampleViewController.h; sourceTree = ""; }; 3BBECF6318A1EAB100A2499D /* KINWebBrowserExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KINWebBrowserExampleViewController.m; sourceTree = ""; }; 3BBECF6418A1EAB100A2499D /* KINWebBrowserExampleViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KINWebBrowserExampleViewController.xib; sourceTree = ""; }; - 4D246F90867446D07C788DCE /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; - E95061206B0428F84E5EAF94 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; + C29E741D1DB8A02D0058C106 /* Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = ""; }; + D55AFEF6AACABA699C9D8738 /* Pods-KINWebBrowserExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KINWebBrowserExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-KINWebBrowserExample/Pods-KINWebBrowserExample.debug.xcconfig"; sourceTree = ""; }; + EEE34F1E750ABC931B5340E0 /* Pods-KINWebBrowserExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KINWebBrowserExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-KINWebBrowserExample/Pods-KINWebBrowserExample.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -68,7 +70,7 @@ 3BBECF2B18A1E58D00A2499D /* CoreGraphics.framework in Frameworks */, 3BBECF2D18A1E58D00A2499D /* UIKit.framework in Frameworks */, 3BBECF2918A1E58D00A2499D /* Foundation.framework in Frameworks */, - 0B4A989B6C1762F306885B5D /* libPods.a in Frameworks */, + F513409AC812CFC9F2355928 /* libPods-KINWebBrowserExample.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -113,7 +115,7 @@ 3BBECF2A18A1E58D00A2499D /* CoreGraphics.framework */, 3BBECF2C18A1E58D00A2499D /* UIKit.framework */, 3BBECF4118A1E58D00A2499D /* XCTest.framework */, - 4D246F90867446D07C788DCE /* libPods.a */, + 20A432E1AB91AADA983CEFC5 /* libPods-KINWebBrowserExample.a */, ); name = Frameworks; sourceTree = ""; @@ -128,6 +130,7 @@ 3BBECF6418A1EAB100A2499D /* KINWebBrowserExampleViewController.xib */, 3BBECF3A18A1E58D00A2499D /* Images.xcassets */, 3BBECF2F18A1E58D00A2499D /* Supporting Files */, + C29E741D1DB8A02D0058C106 /* Launch Screen.storyboard */, ); path = KINWebBrowserExample; sourceTree = ""; @@ -164,8 +167,8 @@ F41A3D371A44A50919509CDE /* Pods */ = { isa = PBXGroup; children = ( - E95061206B0428F84E5EAF94 /* Pods.debug.xcconfig */, - 0D66287F09CB3E898333BDB8 /* Pods.release.xcconfig */, + D55AFEF6AACABA699C9D8738 /* Pods-KINWebBrowserExample.debug.xcconfig */, + EEE34F1E750ABC931B5340E0 /* Pods-KINWebBrowserExample.release.xcconfig */, ); name = Pods; sourceTree = ""; @@ -177,11 +180,12 @@ isa = PBXNativeTarget; buildConfigurationList = 3BBECF5118A1E58E00A2499D /* Build configuration list for PBXNativeTarget "KINWebBrowserExample" */; buildPhases = ( - 6F51916B9AD244238CE3E060 /* Check Pods Manifest.lock */, + 6F51916B9AD244238CE3E060 /* [CP] Check Pods Manifest.lock */, 3BBECF2118A1E58D00A2499D /* Sources */, 3BBECF2218A1E58D00A2499D /* Frameworks */, 3BBECF2318A1E58D00A2499D /* Resources */, - F23BEC6F0D11442D85D78196 /* Copy Pods Resources */, + F23BEC6F0D11442D85D78196 /* [CP] Copy Pods Resources */, + AA798053815ECDCA7FA428BB /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -217,9 +221,13 @@ isa = PBXProject; attributes = { CLASSPREFIX = KIN; - LastUpgradeCheck = 0600; + LastUpgradeCheck = 0800; ORGANIZATIONNAME = "Kinwa, Inc."; TargetAttributes = { + 3BBECF2418A1E58D00A2499D = { + DevelopmentTeam = G7D8C6342Q; + ProvisioningStyle = Automatic; + }; 3BBECF3F18A1E58D00A2499D = { TestTargetID = 3BBECF2418A1E58D00A2499D; }; @@ -250,6 +258,7 @@ files = ( 3BBECF6618A1EAB100A2499D /* KINWebBrowserExampleViewController.xib in Resources */, 3BBECF3318A1E58D00A2499D /* InfoPlist.strings in Resources */, + C29E741E1DB8A02D0058C106 /* Launch Screen.storyboard in Resources */, 3BBECF3B18A1E58D00A2499D /* Images.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -265,14 +274,14 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 6F51916B9AD244238CE3E060 /* Check Pods Manifest.lock */ = { + 6F51916B9AD244238CE3E060 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Check Pods Manifest.lock"; + name = "[CP] Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; @@ -280,19 +289,34 @@ shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; - F23BEC6F0D11442D85D78196 /* Copy Pods Resources */ = { + AA798053815ECDCA7FA428BB /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Copy Pods Resources"; + name = "[CP] Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-KINWebBrowserExample/Pods-KINWebBrowserExample-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + F23BEC6F0D11442D85D78196 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-KINWebBrowserExample/Pods-KINWebBrowserExample-resources.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -359,13 +383,19 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -378,7 +408,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -398,20 +428,25 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; @@ -420,13 +455,16 @@ }; 3BBECF5218A1E58E00A2499D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = E95061206B0428F84E5EAF94 /* Pods.debug.xcconfig */; + baseConfigurationReference = D55AFEF6AACABA699C9D8738 /* Pods-KINWebBrowserExample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + DEVELOPMENT_TEAM = G7D8C6342Q; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "KINWebBrowserExample/KINWebBrowserExample-Prefix.pch"; INFOPLIST_FILE = "KINWebBrowserExample/KINWebBrowserExample-Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "com.kinwa.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -434,13 +472,16 @@ }; 3BBECF5318A1E58E00A2499D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 0D66287F09CB3E898333BDB8 /* Pods.release.xcconfig */; + baseConfigurationReference = EEE34F1E750ABC931B5340E0 /* Pods-KINWebBrowserExample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + DEVELOPMENT_TEAM = G7D8C6342Q; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "KINWebBrowserExample/KINWebBrowserExample-Prefix.pch"; INFOPLIST_FILE = "KINWebBrowserExample/KINWebBrowserExample-Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "com.kinwa.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -462,6 +503,7 @@ "$(inherited)", ); INFOPLIST_FILE = "KINWebBrowserExampleTests/KINWebBrowserExampleTests-Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "com.kinwa.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUNDLE_LOADER)"; WRAPPER_EXTENSION = xctest; @@ -480,6 +522,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "KINWebBrowserExample/KINWebBrowserExample-Prefix.pch"; INFOPLIST_FILE = "KINWebBrowserExampleTests/KINWebBrowserExampleTests-Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "com.kinwa.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUNDLE_LOADER)"; WRAPPER_EXTENSION = xctest; diff --git a/ExampleProject/KINWebBrowserExample/KINWebBrowserExample-Info.plist b/ExampleProject/KINWebBrowserExample/KINWebBrowserExample-Info.plist index 9634e74..a981ade 100644 --- a/ExampleProject/KINWebBrowserExample/KINWebBrowserExample-Info.plist +++ b/ExampleProject/KINWebBrowserExample/KINWebBrowserExample-Info.plist @@ -9,7 +9,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.kinwa.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -24,10 +24,14 @@ 1.0 LSRequiresIPhoneOS + UILaunchStoryboardName + Launch Screen UIRequiredDeviceCapabilities armv7 + UIRequiresFullScreen + UISupportedInterfaceOrientations UIInterfaceOrientationPortrait diff --git a/ExampleProject/KINWebBrowserExample/Launch Screen.storyboard b/ExampleProject/KINWebBrowserExample/Launch Screen.storyboard new file mode 100644 index 0000000..5685239 --- /dev/null +++ b/ExampleProject/KINWebBrowserExample/Launch Screen.storyboard @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ExampleProject/KINWebBrowserExampleTests/KINWebBrowserExampleTests-Info.plist b/ExampleProject/KINWebBrowserExampleTests/KINWebBrowserExampleTests-Info.plist index 851ad66..169b6f7 100644 --- a/ExampleProject/KINWebBrowserExampleTests/KINWebBrowserExampleTests-Info.plist +++ b/ExampleProject/KINWebBrowserExampleTests/KINWebBrowserExampleTests-Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.kinwa.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType From 4cabfc508cb334391d29e6733bcf8d4b2f8a6172 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 20 Apr 2017 16:04:52 +0800 Subject: [PATCH 4/5] make it available for UIWebView loading self-signed url request --- KINWebBrowser/KINWebBrowserViewController.m | 33 +++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/KINWebBrowser/KINWebBrowserViewController.m b/KINWebBrowser/KINWebBrowserViewController.m index c8a85a5..32a09bf 100644 --- a/KINWebBrowser/KINWebBrowserViewController.m +++ b/KINWebBrowser/KINWebBrowserViewController.m @@ -38,7 +38,7 @@ static void *KINWebBrowserContext = &KINWebBrowserContext; static BOOL onlyUIWebViewApplied; -@interface KINWebBrowserViewController () +@interface KINWebBrowserViewController () @property (nonatomic, assign) BOOL previousNavigationControllerToolbarHidden, previousNavigationControllerNavigationBarHidden; @property (nonatomic, strong) UIBarButtonItem *backButton, *forwardButton, *refreshButton, *stopButton, *fixedSeparator, *flexibleSeparator; @@ -48,7 +48,8 @@ @interface KINWebBrowserViewController () @property (nonatomic, strong) NSURL *uiWebViewCurrentURL; @property (nonatomic, strong) NSURL *URLToLaunchWithPermission; @property (nonatomic, strong) UIAlertView *externalAppPermissionAlertView; - +@property (nonatomic, assign) BOOL authenticated; +@property (nonatomic, strong) NSURLRequest *failedRequest; @end @implementation KINWebBrowserViewController @@ -225,6 +226,27 @@ - (void)setActionButtonHidden:(BOOL)actionButtonHidden { [self updateToolbarState]; } +#pragma mark - NSURLConnectionDataDelegate + +- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { + if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { + NSURL *baseURL = self.failedRequest.URL; +// if ([challenge.protectionSpace.host isEqualToString:baseURL.host]) { + [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge]; +// } else { +// NSLog(@"Not trusting connection to host %@", challenge.protectionSpace.host); +// } + } + [challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge]; +} + +- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { + self.authenticated = YES; + [connection cancel]; + if (self.uiWebView) { + [self.uiWebView loadRequest:self.failedRequest]; + } +} #pragma mark - UIWebViewDelegate @@ -232,6 +254,13 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *) if(webView == self.uiWebView) { if(![self externalAppRequiredToOpenURL:request.URL]) { + if ([request.URL.scheme isEqualToString:@"https"] && !self.authenticated) { + self.failedRequest = request; + NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; + [connection start]; + return NO; + } + self.uiWebViewCurrentURL = request.URL; self.uiWebViewIsLoading = YES; [self updateToolbarState]; From d073c7afb491361e50111b05dcdff47531a8dcbc Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 10 May 2017 07:26:44 +0800 Subject: [PATCH 5/5] =?UTF-8?q?remove=20unused=20var=20=E2=80=98baseURL?= =?UTF-8?q?=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KINWebBrowser/KINWebBrowserViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KINWebBrowser/KINWebBrowserViewController.m b/KINWebBrowser/KINWebBrowserViewController.m index 32a09bf..5364032 100644 --- a/KINWebBrowser/KINWebBrowserViewController.m +++ b/KINWebBrowser/KINWebBrowserViewController.m @@ -230,7 +230,7 @@ - (void)setActionButtonHidden:(BOOL)actionButtonHidden { - (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { - NSURL *baseURL = self.failedRequest.URL; +// NSURL *baseURL = self.failedRequest.URL; // if ([challenge.protectionSpace.host isEqualToString:baseURL.host]) { [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge]; // } else {