Problem running i18next

I have an issue with i18next, which I used for years for translation with PhoneGap.

It seems that it does not work with newer iOS. However, even with ios 5.1.0 compìler throws an error.

I’ve tried plugins susch as cordova-plugin-wkwebview-file-xhr and cordova-plugin-wkwebview-engine, but it is still not working.

Also tried :

    <plugin name="@castana/cordova-plugin-ios-xhr" />

with

    		<preference name="AllowUntrustedCerts"  value="true" />
    		<preference name="InterceptRemoteRequests" value="all" />
    		<preference name="allowFileAccessFromFileURLs" value="true" />
    		<preference name="allowUniversalAccessFromFileURLs" value="true" />

I use CDVWKWebViewEngine:

    <platform name="ios">
        <preference name="WKWebViewOnly" value="true" />
        <feature name="CDVWKWebViewEngine"><param name="ios-package" value="CDVWKWebViewEngine" /></feature>
        <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
    </platform>

My CSP:

`<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:; prefetch-src 'self';">`

And the kind of error I see in Inspect:

    /var/containers/Bundle/Application/CE6EDA78-1B4A-4B13-9293-92B9495532F1/appname.app/www/appname.de.json:1 OPTIONS file:///var/containers/Bundle/Application/CE6EDA78-1B4A-4B13-9293-92B9495532F1/appname.app/www/translation.de.json
    index.html:595 XMLHttpRequest cannot load file:///var/containers/Bundle/Application/CE6EDA78-1B4A-4B13-9293-92B9495532F1/appname.app/www/translation.de.json. Preflight response is not successful

It is really frustrating, so I’d appreciate the help!

Tip : If you’re pasting code, html or config files, surround the code with triple back ticks (```), before the first line and after the last one. It will be formatted properly. (We fixed it for you this time)

Thanks. So what can i do?

I tried running older iOS engines such as <engine name="ios" spec="5.1.0" />, but I always get a compilation error

Correct - Cordova does not support building with such old versions. Apps built with that version also won’t be accepted by Apple.

Part of the problem is that, while PhoneGap did accept a range of versions, Volt does not, which makes it very difficult. For instance, right now even <engine name="android" spec="9.0.0" /> will generate a compiler error

Using <engine name="android" spec="9.0.0" /> should be fine - it’s even still the default. VoltBuilder also accepts "10.1.1" as a spec.

What compiler error are you seeing? Could it be caused by an out of date plugin?

PhoneGap was discontinued more than a year ago. By then, it was well over a year out date - so, almost 3 years out of date with the current world. In the meantime, there have been several new releases of Android and iOS, as well as major changes to Chrome and Safari. The clock cannot turn back to the days of PhoneGap.

The issue is with iOS, I’d need to compile with an earlier as I’m currently unable to make i18next translations load on iOS6 engine.

IOS engine 4.3.1 throws this errors even with no plugins in config.xml

UserError: CordovaError: Promise rejected with non-error: Error code 70 for command: xcodebuild with args: -exportArchive,-archivePath,PAcalculate.xcarchive,-exportOptionsPlist,/Users/voltbuilder/Code/VoltBuilder/upload/19897fb5-950f-47eb-bfbd-ecb4ff1f91ca/platforms/ios/exportOptions.plist,-exportPath,/Users/voltbuilder/Code/VoltBuilder/upload/19897fb5-950f-47eb-bfbd-ecb4ff1f91ca/platforms/ios/build/device

IOS engine 5.1.0 does compile, though a couple of weeks ago it would just show a blank screen when opened in the phone. Seems fine now, I guess due to changes in config.xml

As I understand, Apple won’t accept apps which are built with such an old version. Does it make sense to do this?

I just realized that Apple is extremely adamant about this:

This app was built with the iOS 9.1 SDK. All iOS apps submitted to the App Store must be built with the iOS 14 SDK or later, included in Xcode 12 or later.

Which certainly makes previous engine versions only good for testing.

I was hoping for a quick and dirty solution because I cannot get i18next to load translations with current iOS engine and I am desperate. Any ideas?

I’d contact the maintainer of i18next for help with that library.