簡體   English   中英

WKWebView iOS 中的 Google 登錄按鈕沒有響應

[英]Google Sign-In button in WKWebView iOS not responding

在我的應用程序中,登錄頁面位於 WKWebView 中,可以選擇使用 Google Auth 登錄:https://developers.google.com/identity/sign-in/web/build-button但按鈕沒有響應。

此外,我嘗試將登錄 URL 與上面的 URL (谷歌文檔)切換,因為它包含谷歌登錄按鈕的示例,並且該按鈕也沒有響應。

這是我的 WKWebView 配置,帶有 google 的文檔鏈接:

- (void)initWebView {
    WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectZero];
    [self.contentView addSubview:webView];
    [webView setTranslatesAutoresizingMaskIntoConstraints:NO];
    [[webView.topAnchor constraintEqualToAnchor:self.contentView.topAnchor constant:0] setActive:YES];
    [[webView.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor constant:0] setActive:YES];
    [[webView.trailingAnchor constraintEqualToAnchor:self.contentView.trailingAnchor constant:0] setActive:YES];
    [[webView.bottomAnchor constraintEqualToAnchor:self.contentView.bottomAnchor constant:0] setActive:YES];
    self.webView = webView;
    webView.navigationDelegate = self;
    
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://developers.google.com/identity/sign-in/web/build-button"]];
    [request setValue:[self getUserAgent] forHTTPHeaderField:@"User-Agent"];
    [self.webView loadRequest:request];
}

當我嘗試在 safary 的 web 檢查器打開的情況下單擊按鈕時,我也沒有看到任何響應。

任何幫助將不勝感激,謝謝。

PS:為了清楚起見,沒有調用 WKWebView 委托。

顯然,自 2016 年以來,谷歌不再允許在稱為“網絡視圖”的嵌入式瀏覽器中向谷歌發出 OAuth 請求,如此所述。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM