|
|
@@ -398,6 +398,9 @@
|
|
|
NSString *format = @"MM/dd/YYYY";
|
|
|
UIDatePickerMode mode = UIDatePickerModeDate;
|
|
|
|
|
|
+ type = @"dateTime";
|
|
|
+ value = @"09/22/1028 14:44:24";
|
|
|
+
|
|
|
if ([type isEqualToString:@"date"]) {
|
|
|
|
|
|
} else if ([type isEqualToString:@"time"]) {
|
|
|
@@ -712,6 +715,69 @@
|
|
|
}
|
|
|
|
|
|
#pragma mark - WKNavigationDelegate
|
|
|
+
|
|
|
+- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation {
|
|
|
+ NSLog(@"start");
|
|
|
+}
|
|
|
+
|
|
|
+- (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation {
|
|
|
+ NSLog(@"%s",__func__);
|
|
|
+}
|
|
|
+
|
|
|
+- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler {
|
|
|
+ NSLog(@"%s",__func__);
|
|
|
+
|
|
|
+
|
|
|
+ //1)获取trust object
|
|
|
+ SecTrustRef trust = challenge.protectionSpace.serverTrust;
|
|
|
+ SecTrustResultType result;
|
|
|
+
|
|
|
+ //2)SecTrustEvaluate对trust进行验证
|
|
|
+ OSStatus status = SecTrustEvaluate(trust, &result);
|
|
|
+
|
|
|
+ // CFArrayRef defaultPolicies = NULL;
|
|
|
+ // SecTrustCopyPolicies(trust, &defaultPolicies);
|
|
|
+ // NSLog(@"default policies: %@",(__bridge id)defaultPolicies);
|
|
|
+
|
|
|
+ NSMutableArray *policies = [NSMutableArray array];
|
|
|
+ [policies addObject:(__bridge_transfer id)SecPolicyCreateBasicX509()];
|
|
|
+ SecTrustSetPolicies(trust, (__bridge CFArrayRef)policies);
|
|
|
+
|
|
|
+ if (status == errSecSuccess && (result == kSecTrustResultProceed || result == kSecTrustResultUnspecified)) {
|
|
|
+
|
|
|
+ //3)验证成功,生成NSURLCredential凭证cred,告知challenge的sender使用这个凭证来继续连接
|
|
|
+ NSURLCredential *cred = [NSURLCredential credentialForTrust:trust];
|
|
|
+ [challenge.sender useCredential:cred forAuthenticationChallenge:challenge];
|
|
|
+ if (completionHandler) {
|
|
|
+ completionHandler(NSURLSessionAuthChallengeUseCredential,cred); // 使用证书
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ [challenge.sender cancelAuthenticationChallenge:challenge];
|
|
|
+
|
|
|
+ //4)验证失败,取消这次验证流程
|
|
|
+ if (completionHandler) {
|
|
|
+ completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge,nil); // 忽略证书
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error {
|
|
|
+ NSLog(@"%s",__func__);
|
|
|
+ NSLog(@"error: %@", error.localizedDescription);
|
|
|
+}
|
|
|
+
|
|
|
+- (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation {
|
|
|
+ NSLog(@"%s",__func__);
|
|
|
+}
|
|
|
+
|
|
|
+- (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView {
|
|
|
+ NSLog(@"%s",__func__);
|
|
|
+}
|
|
|
+
|
|
|
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
|
|
|
{
|
|
|
// self.wkwebView.scrollView.scrollEnabled = NO;
|
|
|
@@ -750,6 +816,7 @@
|
|
|
|
|
|
- (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler
|
|
|
{
|
|
|
+ NSLog(@"%s",__func__);
|
|
|
decisionHandler(WKNavigationResponsePolicyAllow);
|
|
|
}
|
|
|
@end
|