第26月第28天 avplayer cache
阿新 • • 發佈:2018-11-28
1.urlsession https
- (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler { //AFNetworking中的處理方式 NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling; __block NSURLCredential*credential = nil; //判斷伺服器返回的證書是否是伺服器信任的 if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; /*disposition:如何處理證書 NSURLSessionAuthChallengePerformDefaultHandling:預設方式處理 NSURLSessionAuthChallengeUseCredential:使用指定的證書 NSURLSessionAuthChallengeCancelAuthenticationChallenge:取消請求*/ if (credential) { disposition = NSURLSessionAuthChallengeUseCredential; } else { disposition = NSURLSessionAuthChallengePerformDefaultHandling; } } else { disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge; }//安裝證書 if (completionHandler) { completionHandler(disposition, credential); } }
https://www.jianshu.com/p/4b5d2d47833d
2.avplayer cache
https://github.com/XTShow/XTAudioPlayer/
https://www.jianshu.com/p/c157476474f1
https://github.com/newyjp/JPVideoPlayer