Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

WKWebview
Started by cublah Dec 19 2019 01:18 AM

5 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

cublah

[GLOBAL: userInfoPane.html]
cublah
  • Contributor

  • 386 posts
  • Corona SDK

So I noticed uiwebview was upgraded to WKWebview which is great, it’s much faster with the nitro JavaScript engine in iOS, although I have a problem I want to run a web page from the documents directory and it doesn’t seem to work, on investigation into the source code I see that when initializing the web view there is no configuration set to allow this, to make this work how can I get this added to the core source.

below is the code needed to be added to Rtt_IPhoneWebViewObject.mm at approx line 133

WKWebViewConfiguration *theConfiguration = [[WKWebViewConfiguration alloc] init];
    
[theConfiguration.preferences  setValue:@YES forKey:@"allowFileAccessFromFileURLs"]; 
// needed to run web page from documents directory

[theConfiguration.preferences  setValue:@YES forKey:@"OfflineApplicationCacheIsEnabled"]; 
// needed to run web page from documents directory

// alternative initialization for web view
fWebView = [[WKWebView alloc] initWithFrame:webViewRect configuration:theConfiguration]; 


[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,539 posts
  • Enterprise

What version of Corona are you using? I thought we fixed this.

 

Rob



[TOPIC: post.html]
#3

cublah

[GLOBAL: userInfoPane.html]
cublah
  • Contributor

  • 386 posts
  • Corona SDK

2019.3562

 

if the source code is correct on github, then WKWebview isn’t configured for local files



[TOPIC: post.html]
#4

cublah

[GLOBAL: userInfoPane.html]
cublah
  • Contributor

  • 386 posts
  • Corona SDK

I don’t see where this was even mentioned or fixed, uiwebview will load local files but you transitioned to WKWebview on the 22nd nov and you have to handle that differently, this is something I’ve dealt with a lot in native iOS. 



[TOPIC: post.html]
#5

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,539 posts
  • Enterprise

If you're comfortable, you could pull down the source code, make the change, and after you test it, make a pull request to send your changes back up stream.

 

These are the kinds of things that the community can do to really help!

 

Rob



[TOPIC: post.html]
#6

cublah

[GLOBAL: userInfoPane.html]
cublah
  • Contributor

  • 386 posts
  • Corona SDK

Unfortunately I’m not a big github user, we use Perforce for our version control, although I could give it a go I’m sure, but if somebody wants to help then I know what the change has to be




[topic_controls]
[/topic_controls]