Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web images can't display properly #65

Open
RangerSolo opened this issue Jul 1, 2019 · 3 comments
Open

Web images can't display properly #65

RangerSolo opened this issue Jul 1, 2019 · 3 comments

Comments

@RangerSolo
Copy link

2019-07-01 18:53:36.568810+0800 local_env[20397:321766] Task <3FDFAABF-21DE-4012-90EF-666E0387812D>.<135> load failed with error Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “.com” which could put your confidential information at risk." UserInfo={NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, NSErrorPeerCertificateChainKey=(
"<cert(0x7fcf431c9a00) s: .mrrck.com i: Encryption Everywhere DV TLS CA - G1>",
"<cert(0x7fcf4398a800) s: Encryption Everywhere DV TLS CA - G1 i: DigiCert Global Root CA>"
), NSErrorClientCertificateStateKey=0, NSErrorFailingURLKey=https://
/uploadFiles/2018-05-24/20180524102040316158.jpg, NSErrorFailingURLStringKey=https://
/uploadFiles/2018-05-24/20180524102040316158.jpg, NSUnderlyingError=0x600003f14180 {Error Domain=kCFErrorDomainCFNetwork Code=-1202 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x600000200990>, _kCFNetworkCFStreamSSLErrorOriginalValue=-9814, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9814, kCFStreamPropertySSLPeerCertificates=(
"<cert(0x7fcf431c9a00) s: .mrrck.com i: Encryption Everywhere DV TLS CA - G1>",
"<cert(0x7fcf4398a800) s: Encryption Everywhere DV TLS CA - G1 i: DigiCert Global Root CA>"
)}}, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <3FDFAABF-21DE-4012-90EF-666E0387812D>.<135>",
"LocalDataTask <90768F4A-1385-4326-944C-9CF11BB7C23C>.<154>"
), _kCFStreamErrorCodeKey=-9814, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <3FDFAABF-21DE-4012-90EF-666E0387812D>.<135>, NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x600000200990>, NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be “
.com” which could put your confidential information at risk.} [-1202]

@CocoaDebug
Copy link
Owner

Can you put some demo codes here ?

@CocoaDebug CocoaDebug changed the title 你好,我只要pod集成,阿里云的图片就不能显示,只有删掉库才会展示 Aliyun images can't display properly Jul 1, 2019
@RangerSolo
Copy link
Author

我只用pod集成,并没有import和enable(),图片就不能显示,删掉库就可以了,这是图片urlhttps://mb-cdn-test.mrrck.com/uploadFiles/2018-05-24/20180524102040316158.jpg
import UIKit
import Kingfisher

class ViewController: UIViewController, AuthenticationChallengeResponsable {

@IBOutlet weak var imageView: UIImageView!

override func viewDidLoad() {
    super.viewDidLoad()
    
    ImageDownloader.default.authenticationChallengeResponder = self

    self.imageView.kf.setImage(with: URL(string: "https://mb-cdn-test.mrrck.com/uploadFiles/2018-05-24/20180524102040316158.jpg"), placeholder: nil)
}

public func downloader(
    _ downloader: ImageDownloader,
    didReceive challenge: URLAuthenticationChallenge,
    completionHandler: (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)
{
    if (challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust) {
        let credntial: URLCredential = URLCredential(trust: challenge.protectionSpace.serverTrust!)
        completionHandler(URLSession.AuthChallengeDisposition.useCredential, credntial)
    }
    completionHandler(.performDefaultHandling, nil)
}

}

@CocoaDebug CocoaDebug changed the title Aliyun images can't display properly Web images can't display properly Jul 3, 2019
@CocoaDebug
Copy link
Owner

You can temporarily disable network monitoring first.
屏幕快照 2019-04-02 上午11 45 56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants