Cordova Cannot Find Plugin.xml for Plugin es6-promise-plugin. Please Try Adding It Again.
Update i October 2020: Due to changes in Cordova for iOS, existing projects that were already adapted need to exist changed.
Update 3 July 2020: Cloud Build Service now includes the required dependencies and fixes.
Update 19 March 2020: Added additional workaround for offline apps.
For those developing hybrid cantankerous-platform apps with SAP Spider web IDE Full-Stack, past making use of the Hybrid Application Toolkit extension and SAP Mobile Services, there is an important update for the iOS platform.
Simply before we bound into the details, I want to remind you about the post-obit:
When you start developing a new mobile app, nosotros strongly recommend that you consider developing this with eitherMDK (Mobile Evolution Kit) for cross platform applications, or our native SDKs (SAP Cloud Platform SDK for iOS orSAP Cloud Platform SDK for Android).
Some background on the WebView components
Cordova for iOS has been using the iOS platform component UIWebView for a long time. UIWebView was originally introduced in iOS 2.0. This component is used past Cordova to brandish web content in a native app. This is the crucial office that makes an app a hybrid app – part native code, part spider web app.
At WWDC 2018 (June 2018), Apple introduced the iOS 12 SDK beta, in which this component was deprecated. It took quite a fleck of fourth dimension for the open source community to adopt the culling component named WKWebView. In that location are plenty of reasons for this to find online, so I'll non go into details here. Note that Apple tree has not removed UIWebView until at present, and volition not do this whatever time presently.
Nevertheless, in December 2019 Apple made an proclamation that impacts apps published in Apple'south iOS App Store:
- The App Store volition no longer accept new apps using UIWebView as of April 2020
- The App Store will no longer accept updates for apps using UIWebView as of December 2020
My expectation is that Apple tree will remove UIWebView in 2021 with the introduction of iOS xv. I can be wrong here; but this seems the near logical at this point.
Impact for your hybrid app
What does this mean for you as a developer, having used Hybrid Application Toolkit to build iOS apps ?
- If you are planning to publish a new app, you should get-go of all consider using MDK.
- If you lot still get ahead with a hybrid app, then this iOS app must apply WKWebView from April 2020 onwards, BUT Just WHEN YOU INTEND TO PUBLISH THE APP IN THE PUBLIC APP STORE. If you intend to distribute your app within your enterprise, using a mobile device management solution, then you are not tied to this deadline.
- If you accept an existing app in the AppStore, yous have until Dec 2020 to switch to WKWebView for publishing updates.
- Speculative: when Apple tree rolls out iOS 15 in 2021, your UIWebView based apps will not work anymore.
How to ensure your app uses WKWebView
New apps
For new mobile hybrid apps created in SAP Web IDE Total-Stack with Hybrid Application Toolkit, we take updated our template code to ensure WKWebView is used past default. As soon equally you 'mobile-enable' your project, information technology will automatically be configured for this. Once y'all rebuild the app with our Cloud Build Service, the resulting app uses WKWebView.
Existing apps that were not yet adapted for WKWebView
Update 1 October 2020: This is no longer needed. You can skip this. I am leaving this here for reference merely.
For existing apps, yous will take to modify your code and configuration settings, and trigger a new build with our Cloud Build Service. Steps:
-
Add the cordova plugin "cordova-plugin-wkwebview-engine" to your projection.The easiest manner to practise this is by opening the projection context carte (correct-click on the project) and select Mobile > Select Cordova Plugins. So search for the to a higher place mentioned plugin in the list of publicly available plugins, add information technology, and save the selection. - Optionally, as our Cloud Build Service should be adding this automatically as of 3 July 2020 (you tin download the XCode projection and verify yourself if you are in dubiety):
-
Add<preference proper noun="WKWebViewOnly" value="true" />in config.xml to ensure UIWebView is completely removed at compile-time.
-
Ensure cordova ios 5.1.1 or later is used. -
In config.xml, add together<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" /> <feature name="CDVWKWebViewEngine"> <param proper noun="ios-package" value="CDVWKWebViewEngine" /> </feature>
-
Existing apps that were already adapted for using WKWebView
Our latest Deject Build Service makes use of Cordova for iOS version half-dozen.1.0. In this Cordova version UIWebView has been completely removed and we no longer need to use the wkwebview-engine plugin and some of the configuration settings related to it.
In your project in SAP Web IDE Full-Stack, please remove the post-obit settings from config.xml:
<feature name="CDVWKWebViewEngine"> <param name="ios-package" value="CDVWKWebViewEngine"/> </feature> <preference proper name="CordovaWebViewEngine" value="CDVWKWebViewEngine"/> <preference name="WKWebViewOnly" value="true"/> And too brand certain the Cordova plugin "cordova-plugin-wkwebviewengine" is no longer selected.
Offline Apps
If your app is making use of offline OData sources, and so our Kapsel OData plugin will handle the connexion with SAP Cloud Platform Mobile Services. This is implemented in native code; so information technology will not employ WKWebView.
Update iii July 2020: this fix is already available in our Cloud Build Service. Y'all can skip this.
For offline apps, either new, or existing ones, at that place is an additional change required. This is a temporary workaround until the Mobile SDK (Kapsel) is updated.
In this blog mail I've provided an case of how to initialise an offline shop. In the success callback nosotros utilise the sap.OData.applyHttpClient() to ensure offline OData calls apply datajs. This volition also enable Xhook for treatment calls to fetch local media files. Nonetheless, this slice has an upshot and a ready will be provided presently. Until our Deject Build Service is updated with this fix, please disable Xhook by calling sap.Xhook.disable().
var openStoreSuccessCallback = function() { sap.OData.applyHttpClient(); //Offline OData calls can now be made against datajs. sap.Xhook.disable(); // temporary workaround to ensure the offline app can work in WKWebView sap.hybrid.startApp(); } Handling XMLHttpRequests (XHR) in WKWebView
If your app requires access to web services via XMLHttpRequests (XHR), you will probably run into authentication errors (403 forbidden) due to CORS restrictions in WKWebView.
To resolve these we have advised some customers to make use of the AuthProxy plugin. Yet, we have found another solution for this. When you 'mobile-enable' a project, our template code will automatically include this. Make sure to configure the server side settings mentioned below.
In existing projects delight ensure the last code lines of this snippet are applied for Ajax in WKWebView (you can observe this in the file mobile/index.html):
window.XMLHttpRequest.prototype.open up = function (method, url, async, user, countersign) { if (fiori_client_appConfig && mobile_appRoutes && url && url.indexOf("resource/") !== 0 && url.indexOf("./") !== 0) { // skip local files // match a local access URL to a path of application information routes var route = null; for (var i = 0; i < mobile_appRoutes.length; i++) { if (url.indexOf(mobile_appRoutes[i].path) === 0 || ("/" + url).indexOf(mobile_appRoutes[i].path) === 0) { road = mobile_appRoutes[i]; interruption; } } if (route) { // path matched arguments[1] = remoteBase + sap.hybrid.packUrl(url, road); // pack a remote admission URL } } originalOpen.apply(this, arguments); if (url && (url.indexOf("https://") === 0 || url.indexOf("http://") === 0)) { this.setRequestHeader('Cache-Control', 'no-cache'); if (cordova.crave("cordova/platform").id == "ios" && window.webkit && window.webkit.messageHandlers) { // Ajax in WkWebview this.withCredentials = truthful; // otherwise cookies are not sent causing 403 } } }; And so nosotros just need to configure CORS in the application configuration in SAP Cloud Platform Mobile Services.
Open the SAP Cloud Platform Mobile Services Admin Cockpit. Become to Settings > Security > Cross Domain Access. Fix Origin field to "<AdminAPI>,null". The value for <AdminAPI> tin be found in the Of import Links folio. Note: delight remove the trailing slash "/" in the <AdminAPI>.
Where to find to AdminAPI:
Improvements coming with WKWebView
Noticeable changes with the WebView are in the area of (perceived) performance:
- Faster JavaScript engine, using Nitro.
- WKWebView runs out of process.
- JavaScript is handled asynchronously, eliminating blocking calls.
- Improvements in treatment touch on events (less filibuster).
Challenges coming with WKWebView
Besides improvements, at that place are unfortunately also some issues introduced. The primary issue is that WKWebView comes with stricter cross origin resource sharing rules (CORS). To resolve some of these, we are making use of the Kapsel native plugin "AuthProxy".
When debugging the app using Safari (remote debug), you will not see the traffic going through native code. In case yous want to debug these calls (e.g. OData queries), it is recommended to employ the Network Traces feature in the SAP Mobile Services cockpit.
When can yous make the switch?
You can switch to WKWebView now and start testing. To comply with the App Shop submission guidelines for new apps gear up by Apple, you need to use Cordova for iOS 5.1.1 or later in lodge to completely remove any reference to UIWebView. This update has been released in the Mobile SDK last month and is from 3 July 2020 available on our Deject Build Service.
In instance y'all run into problems
We have thoroughly tested the apps generated with Hybrid Application Toolkit and did not find issues after making the switch to WKWebView. However, your apps might make utilise of features (or plugins) that are affected by this alter. Please ensure you test your apps earlier rolling them out to your users.
In instance you are facing issues, please raise a support ticket for component CA-WDE-MOB.
Thanks,
Ludo Noens
Source: https://blogs.sap.com/2020/03/16/hybrid-application-toolkit-apps-for-ios-switching-to-wkwebview/
0 Response to "Cordova Cannot Find Plugin.xml for Plugin es6-promise-plugin. Please Try Adding It Again."
Post a Comment