From 7d923d7db191c701765a66ef15fcff439b300e67 Mon Sep 17 00:00:00 2001 From: Tao Ren Date: Mon, 30 Sep 2019 15:53:05 -0400 Subject: [PATCH] Bug fixed: crash the DemoApp when do Log in with Twitter(browser). --- .../TwitterKit/Social/Identity/TWTRWebViewController.m | 8 ++++---- .../Attachment Views/TWTRSETweetURLAttachmentView.m | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/TwitterKit/TwitterKit/Social/Identity/TWTRWebViewController.m b/TwitterKit/TwitterKit/Social/Identity/TWTRWebViewController.m index 1091a6e4..309db050 100644 --- a/TwitterKit/TwitterKit/Social/Identity/TWTRWebViewController.m +++ b/TwitterKit/TwitterKit/Social/Identity/TWTRWebViewController.m @@ -150,15 +150,15 @@ - (void)enableCancelButtonWithCancelCompletion:(TWTRWebViewControllerCancelCompl - (void)initWebView { // From: https://stackoverflow.com/questions/26295277/wkwebview-equivalent-for-uiwebviews-scalespagetofit NSString *jScript = @"var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'width=device-width'); document.getElementsByTagName('head')[0].appendChild(meta);"; - + WKUserScript *wkUScript = [[WKUserScript alloc] initWithSource:jScript injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES]; WKUserContentController *wkUController = [[WKUserContentController alloc] init]; [wkUController addUserScript:wkUScript]; - + WKWebViewConfiguration *wkWebConfig = [[WKWebViewConfiguration alloc] init]; wkWebConfig.userContentController = wkUController; - - WKWebView* wkWebV = [[WKWebView alloc] initWithFrame:self.view.frame configuration:wkWebConfig]; + + WKWebView* wkWebV = [[WKWebView alloc] initWithFrame: self.parentViewController.view.frame configuration:wkWebConfig]; [self setWebView:wkWebV]; [[self webView] setNavigationDelegate:self]; diff --git a/TwitterKit/TwitterKit/TwitterShareExtensionUI/Private/Composer/Attachment Views/TWTRSETweetURLAttachmentView.m b/TwitterKit/TwitterKit/TwitterShareExtensionUI/Private/Composer/Attachment Views/TWTRSETweetURLAttachmentView.m index 50827eb4..8d2c4839 100644 --- a/TwitterKit/TwitterKit/TwitterShareExtensionUI/Private/Composer/Attachment Views/TWTRSETweetURLAttachmentView.m +++ b/TwitterKit/TwitterKit/TwitterShareExtensionUI/Private/Composer/Attachment Views/TWTRSETweetURLAttachmentView.m @@ -132,7 +132,7 @@ - (void)setUpConstraints [self.linkDomainLabel.topAnchor constraintEqualToAnchor:self.linkTitleLabel.bottomAnchor].active = YES; [self.linkDomainLabel.bottomAnchor constraintEqualToAnchor:self.labelsContainerView.bottomAnchor].active = YES; - [self.heightAnchor constraintEqualToAnchor:self.linkPreviewImageView.heightAnchor]; +// [self.heightAnchor constraintEqualToAnchor:self.linkPreviewImageView.heightAnchor]; } @end