Skip to content

Commit

Permalink
Bug fixed: crash the DemoApp when do Log in with Twitter(browser).
Browse files Browse the repository at this point in the history
  • Loading branch information
touren committed Sep 30, 2019
1 parent c741e5d commit 7d923d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions TwitterKit/TwitterKit/Social/Identity/TWTRWebViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7d923d7

Please sign in to comment.