iOS Question How to clear the cache of wkwebview?

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
B4X:
Sub clear_cache
 Dim NativeMe As NativeObject = Me
 NativeMe.RunMethod("clearcache", null)
End Sub

#If OBJC
- (void)clearcache {
 [[NSURLCache sharedURLCache]removeCachedResponseForRequest:request];
    [[NSURLCache sharedURLCache] removeAllCachedResponses];
    [[NSURLCache sharedURLCache] setDiskCapacity:0];
    [[NSURLCache sharedURLCache] setMemoryCapacity:0];
}
#End If
Not tested
 
Upvote 0

watesoft

Active Member
Licensed User
Longtime User
B4X:
Sub clear_cache
 Dim NativeMe As NativeObject = Me
 NativeMe.RunMethod("clearcache", null)
End Sub

#If OBJC
- (void)clearcache {
 [[NSURLCache sharedURLCache]removeCachedResponseForRequest:request];
    [[NSURLCache sharedURLCache] removeAllCachedResponses];
    [[NSURLCache sharedURLCache] setDiskCapacity:0];
    [[NSURLCache sharedURLCache] setMemoryCapacity:0];
}
#End If
Not tested
Thanks for the solution!
 
Upvote 0
Top