Cordova Slack Digest

Thu, 16 Sep 2021 08:21:05 GMT

User count: 4620

Join the conversation at slack.cordova.io

Channel #general (3 messages)


Wed, 15 Sep 2021 11:42:10 GMT

@sdemir says

Hello there,

WKWebView loadFileURL method works in iOS 14.X versions but not in iOS 12.X versions.

Parameters

file:///var/mobile/Containers/Data/Application/4206D535-D40F-4C80-85DB-EC0379DFA801/Library/NoCloud/wwww/index.html
nsURLfileroot
file:///var/mobile/Containers/Data/Application/4206D535-D40F-4C80-85DB-EC0379DFA801/Library/NoCloud/wwww/```
*Method Call*
`[(WKWebView*)_engineWebView loadFileURL:nsURLfile allowingReadAccessToURL:nsURLfileroot];`

*Error*
```Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"```
Have you experienced such a problem before?

Wed, 15 Sep 2021 12:43:19 GMT

@norman137 says

Not super familiar with the full url paths on iOS but I‘m pretty sure WKWebView will only load from the application bundle directory or it’s sub directories. I think the URL would look something like /var/mobile/Applications/<UUID>/appname.app/

Attempting to load a document outside of that directory, like data directories will result in an error. Although when people normally ask about this, we usually see a sandbox error, not a Operation not permitted error, so I‘m not sure if I’m really talking about the same thing. Ref: https://github.com/apache/cordova-ios/issues/1063

Wed, 15 Sep 2021 14:24:11 GMT

@sdemir says

I added the https://developer.apple.com/documentation/webkit/wkwebview/1414973-loadfileurl?language=objc|loadFileURL method to https://github.com/uyummobile/cordova-ios|cordova-ios platform.

{
    NSString* fileurlStr = [command argumentAtIndex:0];
    NSString* folderurlStr = [command argumentAtIndex:1];
    NSURL *nsURLfile = [NSURL fileURLWithPath:fileurlStr];
    NSURL *nsURLfileroot = [NSURL fileURLWithPath:folderurlStr];
    NSFileManager* fileManager = [NSFileManager defaultManager];
    
    if ([fileManager fileExistsAtPath:[nsURLfile path]]){
        [(WKWebView*)_engineWebView loadFileURL:nsURLfile allowingReadAccessToURL:nsURLfileroot];
    }else{
        NSLog(@"File does not exist.");
    }
}```
I downloaded and redirected the files to cordova.file.dataDirectory. I used the <https://www.npmjs.com/package/@globules-io/cordova-plugin-ios-xhr|cordova-plugin-ios-xhr> plugin to load the links defined in the index file.

So far everything has been successful. But on iOS 12.X devices it didn't allow me to load files with <https://developer.apple.com/documentation/webkit/wkwebview/1414973-loadfileurl?language=objc|loadFileURL>. I had no problems with version 14.X.

Our updater app downloads the actual app and redirects here. I couldn't get past this error in iOS 12.X version.

Channel #cordova-android (1 messages)


Wed, 15 Sep 2021 18:47:58 GMT

@info460 says

Hello everybody, I have a question about Fullscreen mode. I like to have my app splashcreen and app itself in true fullscreen mode (without top bar and botton SW button bar) I was playing with and combinations of 1. My app have declared in config.xml: <preference name=“Fullscreen” value=“true” /> 2. having cordova fullscreen plugin installed 3. playing and changing AndroidManifest.xml android:theme=“@android:style/Theme.Material.Light.NoActionBar.Fullscreen” and different other themes

but for some reson I cant achieve to have fully fullscreen app. I have either bottom SW buttons bar or transparent both bars which sometimes disappear but sometimes not. Can someone please give some light to this topic? thank you