diff --git a/OnePasswordExtension.m b/OnePasswordExtension.m index cbfdc55..3ed1912 100644 --- a/OnePasswordExtension.m +++ b/OnePasswordExtension.m @@ -226,7 +226,7 @@ - (void)fillItemIntoWebView:(id)webView forViewController:(UIViewController *)vi } }]; } -#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 || ONE_PASSWORD_EXTENSION_ENABLE_WK_WEB_VIEW else if ([webView isKindOfClass:[WKWebView class]]) { [self fillItemIntoWKWebView:webView forViewController:viewController sender:(id)sender showOnlyLogins:yesOrNo completion:^(BOOL success, NSError *error) { if (completion) { @@ -257,7 +257,7 @@ - (void)createExtensionItemForWebView:(id)webView completion:(void (^)(NSExtensi [self createExtensionItemForURLString:uiWebView.request.URL.absoluteString webPageDetails:collectedPageDetails completion:completion]; } -#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 || ONE_PASSWORD_EXTENSION_ENABLE_WK_WEB_VIEW else if ([webView isKindOfClass:[WKWebView class]]) { WKWebView *wkWebView = (WKWebView *)webView; [wkWebView evaluateJavaScript:OPWebViewCollectFieldsScript completionHandler:^(NSString *result, NSError *evaluateError) { @@ -383,7 +383,7 @@ - (void)findLoginIn1PasswordWithURLString:(NSString *)URLString collectedPageDet [forViewController presentViewController:activityViewController animated:YES completion:nil]; } -#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 || ONE_PASSWORD_EXTENSION_ENABLE_WK_WEB_VIEW - (void)fillItemIntoWKWebView:(WKWebView *)webView forViewController:(UIViewController *)viewController sender:(id)sender showOnlyLogins:(BOOL)yesOrNo completion:(void (^)(BOOL success, NSError *error))completion { [webView evaluateJavaScript:OPWebViewCollectFieldsScript completionHandler:^(NSString *result, NSError *error) { if (!result) { @@ -443,7 +443,7 @@ - (void)executeFillScript:(NSString *)fillScript inWebView:(id)webView completio return; } -#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 || ONE_PASSWORD_EXTENSION_ENABLE_WK_WEB_VIEW if ([webView isKindOfClass:[WKWebView class]]) { [((WKWebView *)webView) evaluateJavaScript:scriptSource completionHandler:^(NSString *result, NSError *evaluationError) { BOOL success = (result != nil); diff --git a/README.md b/README.md index 3798cad..8036935 100644 --- a/README.md +++ b/README.md @@ -237,6 +237,12 @@ If your project's Deployment Target is earlier than iOS 8.0, please make sure th +#### WKWebView support for projects with iOS 7.1 or earler as the Deployment Target + +If the **Deployment Target** is `7.1` or earlier in your project or target and you are using `WKWebViews` (runtime checks for iOS 8 deveices), you simply need to add `ONE_PASSWORD_EXTENSION_ENABLE_WK_WEB_VIEW=1` to your `Preprocessor Macros`. + + + ## Best Practices * Use the same `URLString` during Registration and Login.