I am using MobileFirst 6.3. I am not able to call window.plugins.XXX (i want to use SSLcertificateChecker as XXX) . But the window.plugins is coming as undefined.
I want to include SSLCertificateChecker phonegap plugin from https://github.com/EddyVerbruggen/SSLCertificateChecker-PhoneGap-Plugin into my worklight project.
First i tried iOS. I am adding manually all files.
Added
<feature name="SSLCertificateChecker">
<param name="ios-package" value="SSLCertificateChecker" />
</feature> in config.xml
But during implementation window.plugins comes undefined. Not a able to proceed.
It should work by following the same instructions I have provided in this answer, just adjusted to yours.
Note: The same warnings I have written there apply here as well. Namely: on each build performed in MobileFirst Studio the file cordova_plugins.js is being re-generated, thus you will lose the required changes that you will perform in this file, and you will be required to re-do them over and over again.
One possible solution to that is to upgrade to the soon-to-be released MobileFirst Platform Foundation 7.1, which introduces support for another class of application type - Cordova applications, with MobileFirst SDK integrated as a plug-in, thus enabling you to use Cordova Plug-man (or any other method) to install 3rd party plug-ins as you would in any Cordova-based application. Cordova Plug-man is not supported in releases prior to 7.1. Otherwise, you'll just have to find build hacks around it.
config.xml
index.html
Add the following to the header
element:
<script type="text/javascript" src="js/SSLCertificateChecker.js"></script>
SSLCertificateChecker.js
Make sure to place the SSLCertificateChecker.js file in the your-app\common\js folder.
Edit the file.
Add at the top:
cordova.define("nl.x-services.plugins.SSLCertificateChecker", function(require, exports, module) {
Add at the bottom: });
Build
In Build Phases add the required Security.framework (but it will most likely already be there)
Right-click on the project root folder, select "Add Files to..." and copy over the provided .h and .m files
Navigate to native\www\default\worklight\cordova_plugins.js and add the following. This is also the file you will have to re-edit each time you make a build in MobileFirst Studio...
{
"file": "../js/SSLCertificateChecker.js",
"id": "nl.x-services.plugins.SSLCertificateChecker",
"clobbers": [
"window.plugins.sslCertificateChecker"
]
},
Run on iOS Simulator or device.