I am working on cordova-ios app. My App will download zip file(contains html files ex:-second_login.html) from server, then we are unzipping it in data directory. After successful unzipping, app should navigate to second_login.html. App is working fine in UIWebview with cordova-ios 5.1.1. But it is not working in cordova-ios-6.1.0 with WKWebview.
Using cordova-ios-6.1.0, I downloaded and unzipped in data-directory successfully to below path.
/var/mobile/Containers/Data/Application/<APPID>/Library/NoCloud/<APP_NAME>//files/www-24862240/second_login.html.
And for loading this second_login.html, I am using document.location = "<PATH_MENTIONED_ABOVE>"
Initially, we got issue in downloading zip file(Cookie sync issue), for this we have used cordova-plugin-ios-xhr
plugin. then we successfully downloaded zip file.
After 2 months struggle, we found out the solution for my problem. Native Webkit webview is working fine in swift. so we found out that cordova-ios is making some restriction. So we added some methods in cordovaLib xcode project.
Find out WebviewEngine folder in cordovalib xcode project. (cordovaLib.xcodeproj -> private -> plugins -> CDVWebviewEngine)
Add new function in CDVWebViewEngine.h file after
allowsBackForwardNavigationGestures
function- (void)loadFileURL:(CDVInvokedUrlCommand*)command;
3)Add below function in CDVWebViewEngine.m file after
defaultResourcePolicyForURL
functionThen in our application javascript files, use below code to navigate to downloaded bundle files. Here path is zip downloaded and extracted in data directory location with custom folder name(in our case).
if(isIOS()){
Add below preferences in config.xml