gpt4 book ai didi

ios - 可以从共享点 url 运行 WKWebView 吗?

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:37:52 25 4
gpt4 key购买 nike

版本:XCode 6.1 测试版

后端:Sharepoint 2013

下面有疑问的示例代码

调用 viewDidLoad

    WKWebViewConfiguration *theConfiguration = [[WKWebViewConfiguration alloc] init];
WKWebView *webView = [[WKWebView alloc] initWithFrame:self.eyWebView.frame configuration:theConfiguration];
webView.navigationDelegate = self;
NSString *eUrl = [[EYUtility share] encodingUrlWithString:<-sharepoint url->;
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:eUrl]];
[self.view addSubview:webView];
[webView loadRequest:request];

viewDidLoad后调用didReceiveAuthenticationChallenge

-(void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential *))completionHandler{
if (challenge.previousFailureCount == 0){
NSURLCredentialPersistence persistence = NSURLCredentialPersistenceForSession;
NSURLCredential *credential = [NSURLCredential credentialWithUser:@"username" password:@"password" persistence:persistence];
completionHandler(NSURLSessionAuthChallengeUseCredential,credential);
}
else{
NSLog(@"%s: challenge.error = %@", __FUNCTION__, challenge.error);
completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
}
}

在调用身份验证质询之后调用 didFinishNavigation。 wkWebview 显示“请稍候...”。未从共享点 url 中显示。

为什么不从共享点 url 显示它。

最佳答案

这里我使用带有 CustomHTTPProtocol 类的 UIWebview。它将从共享点 url 工作。

https://developer.apple.com/library/ios/samplecode/CustomHTTPProtocol/Introduction/Intro.html

欢呼:-)

关于ios - 可以从共享点 url 运行 WKWebView 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26422149/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com