[AC-6388] iOS: WKWebView bizarre behaviour
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | n/a |
Reporter | Zakhar Zhuravlev |
Assignee | Shak Hossain |
Created | 2019-10-01T11:45:19.000+0000 |
Updated | 2019-10-01T11:45:19.000+0000 |
Description
In our application we have local .html/.js files which we open inside a WebView component like that:
WebView.url = "/Users/zozo4kin/Library/Developer/CoreSimulator/Devices/25286438-5F1B-4679-8C00-1B56A60394E4/data/Containers/Data/Application/C1C5E8BC-F355-438F-81DE-BFC615084B28/Documents/player/index.html"
Webview loads 3D virtual tour inside this player and it works fine till 8 sdk. Starting from 8 sdk, Ti.UI.WebView implements WKWebView inside and this component doesn't work even with direct link to the tour, without using local player.
*It's the first issue.* Ti.UI.Webview can't load this link "https://app.immoviewer.com/portal/tour/1564596?accessKey=5d20" starting from 8 sdk. But if we use ti.wkwebview it works! I attached the zip archive with sample app where we just open screen with UI.Webview and with ti.wkwebview and set as url link above and for UI.WebView it doesn't work, but work for ti.wkwebview native module.
*The second issue is* that ti.wkwebview (and UI.WebView as well) doesn't work if we try to pass link to the local .html file like we did previously.
If we pass path to index.html to url we get this error:
{"url":"file:///file:/Users/itelenkov/Library/Developer/CoreSimulator/Devices/91A2044F-C4D8-4EA4-A80B-E4A7625A682C/data/Containers/Data/Application/522F7607-F7B3-49E5-A9A7-A780A46C718B/Documents/player/index.html","title":"","error":"The requested URL was not found on this server.","bubbles":true,"type":"error","source":{"touchEnabled":true,"horizontalWrap":true,"visible":false},"cancelBubble":false}
"file:///file:/" at the beginning looks weird. We tried to fix that amending source code of ti.wkwebview module like that:
(void)setUrl_:(id)value
{
ENSURE_TYPE(value, NSString);
[[self proxy] replaceValue:value forKey:@"url" notification:NO];
if ([[self webView] isLoading]) {
[[self webView] stopLoading];
}
// Handle remote URL's
if ([value hasPrefix:@"http"] || [value hasPrefix:@"https"]) {
[self loadRequestWithURL:[NSURL URLWithString:[TiUtils stringValue:value]]];
// Handle local URL's (WiP)
} else {
// NSString *path = [[TiUtils toURL:value proxy:self.proxy] absoluteString];
// Hardcode
// NSString *path = @"/Users/itelenkov/Library/Developer/CoreSimulator/Devices/91A2044F-C4D8-4EA4-A80B-E4A7625A682C/data/Containers/Data/Application/EAE3E55B-B0C1-413A-A27B-D264754F5775/Documents/player/index.html";
DebugLod(@"Log Log Log");
[[self webView] loadFileURL:[NSURL fileURLWithPath:value]
allowingReadAccessToURL:[NSURL fileURLWithPath:[value stringByDeletingLastPathComponent]]];
}
}
We fixed this issue with "file:///file:/", but it doesn't work anyway and shows white screen to us. I'm attaching corrected source code of ti.wkwebview as well.
I would appreciate any help. Right now we can't use and do new releases with 8 sdk. We have to stay with 7.5.2 and there is no guarantee that apple will approve us next time if we send a version without wkwebview.
Attachments
File | Date | Size |
---|---|---|
testWKWebView.zip | 2019-10-01T11:37:49.000+0000 | 6432350 |
ti.wkwebview-iphone-2.8.4.zip | 2019-10-01T11:43:31.000+0000 | 781593 |
No comments