WKWebView使用时的[removeDataOfTypes:modifiedSince:completionHandler:]崩溃

运行时错误


2017-08-27 00:47:37.242 wesg-debug[41532:2396580] ERROR: createEncodedCachedResponseAndRequestForXPCTransmission - Invalid protocol-property list - CFURLRequestRef. protoProps=<CFBasicHash 0x6080014749c0 [0x103862e40]>{type = mutable dict, count = 1,
entries =>
    2 : <CFString 0x101d67850 [0x103862e40]>{contents = "connection_register"} = <TBSDKRequestDelegate: 0x60800000f2b0>
}
2017-08-27 00:47:37.242 wesg-debug[41532:2396580] ADD: failed to create cache dictionary at path=/Users/f7/Library/Developer/CoreSimulator/Devices/9469E40A-F450-4182-85AD-5037FF357A59/data/Containers/Data/Application/8382C52F-3CDD-4DB0-BC44-8E53C2E7D3F4/Library/Caches/com.alisports.wesg. key=0x608001471740

WKWebsiteDataStore 清理缓存api


- (void)removeDataOfTypes:(NSSet<NSString *> *)dataTypes forDataRecords:(NSArray<WKWebsiteDataRecord *> *)dataRecords completionHandler:(void (^)(void))completionHandler;

completionHandler 不能为空?但是why??

 [self.wkWebView.configuration.websiteDataStore removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate dateWithTimeIntervalSince1970:0] completionHandler:nil];

警告:Null passed to a callee that requires a non-null argument…

崩溃测试


- (void)viewDidLoad {
    [super viewDidLoad];

    self.wkWebView = [[WKWebView alloc] initWithFrame:self.view.bounds];

    [self.view addSubview:self.wkWebView];

    ///////////////////
    [self.wkWebView.configuration.websiteDataStore removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate dateWithTimeIntervalSince1970:0] completionHandler:nil];
    ///////////////////

    [self.wkWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.baidu.com"]]];
}

崩溃!!!

疑问


为何崩溃呢?有知者请指教。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值