Category: Programming

Pattern cannot match values of type ‘LABiometryType’ in ionic project

I’m getting the following errors while building my ionic 4 app, This error came from a cordova plugin called cordova-plugin-fingerprint-aio , After a long research i fixed this issue by modifying the code in the plugin core files.

File location: src/ios/Fingerprint.swift

Actual code ( Swift )

switch(authenticationContext.biometryType) {
    case .none:
        biometryType = "none";
    case .touchID:
        biometryType = "finger";
    case .faceID:
        biometryType = "face"

Modified code

switch(authenticationContext.biometryType) {
	case LABiometryType.none:
	    biometryType = "none";
	case LABiometryType.typeTouchID:
	    biometryType = "finger";
	case LABiometryType.typeFaceID:
	    biometryType = "face"

The changes fixed the issues and app is working fine. You must remove and add the ios platform again to reflect the changes

PS: I’m not a Swift programmer and i won’t say that the above solution is perfect

How to use SSL pinning with cordova-plugin-advanced-http ?


It’s little bit complex task for the new programmers to use SSL pinning with cordova-plugin-advanced-http plugin. Plugin installation and usage is not so complex, but most of the people have no idea about how to obtain the .cer file for SSL pinning purpose.

I have already published a blog post about how to generate the .cer file, You may just read this blog post first.

In my project i just want to use an HTTPs based url from my ionic application, My client told me its very important for him because we are transferring some sensitive data through this API.

Firstly, I just installed the cordova-plugin-advanced-http plugin and its npm module in our ionic project and then i search on google to find how to generate .cer file. Most of the results just showing some results about how to convert a .pem file to .crt file and actually not solving my issues.

Example ionic application

I have created a git repository to share my sample application




SSL Pinning may not work properly with Live Reload mode



How to integrate SSL in ionic 3 using cordova plugin


It was a little bit hard task for me to integrate SSL in my Ionic 3 app using Cordova due to my lack of knowledge in SSL certificates. As usual i just landed in the HTTP native plugin section under ionic frameworks documentation section. It was not so helpful for me, because neither  this page or its official github page not explaining how to generate the .cer file for SSL pinning, finally i found the solution by reading lots of Stackoverflow answers and other articles.


Install the plugin as per the instruction on the documentation section

How to get the .cer file ?

I’m assuming that you need to make https requests to a single domain only

Method 1

It works only if you had chrome browser on a windows machine with no active antivirus software ( In my case kaspersky using a personal root certificate – that mask the actual SSL certificate keyfile from the user  )

In this case, we can generate .cer file from your chrome browser on windows machine. Just access one of your public api url via chrome browser address bar and then click on the green padlock icon of your https url. then you can export the ssl public key as a .cer file

Watch this video to get clear understanding


Method 2 ( recommended one )

If you have a Linux or Mac machine or use you Linux server terminal – If your machine must have an installation of openssl.

Use the following linux command to obtain the .cer file

openssl s_client -showcerts -connect <domain name>:443 -servername <domain name>:443 </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > certificate.pem

Convert .pem file into .cer file

openssl x509 -inform PEM -in certificate.pem -outform DER -out certificate.cer

Download the certificate.cer file to your local machine and then include a copy on your ionic/cordova project root directory

You must call enableSSLPinning or setSSLCertMode method on your components.ts file based on the version of the installed plugin

That’s all!

preflight response issue with ionic3 app on ios build only [ resolved ]


I was running with the same problem, My ionic 3 app with backend was working just fine, it was not working with IOS ( Iphone x – IoS 11 simulator ). I got some errors like the following.

[Error] failed to load resource: Preflight response is not successful.

[Error] Failed to load resource: Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin.

I’m not seeing this issue from the Android version of the application. Is there a setting or something that can be enabled within the Ionic app to fix the CORS issue?


Workaround only – Not a perfect solution

I changed the `web view` option of my ionic app.
WKWebView ===> UIWebView

First, open config.xml and add the following properties

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

then run the following commands – I hope you are familiar with this commands

ionic cordova plugin remove cordova cordova-plugin-ionic-webview --save
rm -rf platforms/
rm -rf plugins/
ionic cordova build ios



In iOS, there have been two webviews for a few years now, UIWebView and WKWebView. Historically, Ionic apps have used UIWebView, but no longer. Ionic now uses WKWebview by default when building for iOS.

We strongly believe WKWebview is the best option for any app, as it features many improvements over the older, legacy webview (UIWebView). These features include:

  • JIT conversion of JS code down to machine code, which runs much faster
  • Improved rendering performance
  • Less memory consumption
  • Better adherence to web standards
  • Reliable scroll events (important for virtual-list)

We wanted to make sure that people could easily switch to WKWebView without many issues, but there are still some things that you’ll need to consider.

Reference : Ionic wkwebview

How to find chrome extension location in our computer ?

If you are trying to develop a chrome extension, probably you will try to use existing code of the installed extension in your chrome browser. But how to find the location of the source code ?

Use the following steps to find the chrome extension directory.

  1. Open your chrome browser and type this url  chrome://version/ then hit the enter key
  2. Now it will show you a screen like given below
  3. In this screen you see label ‘Profile Path’ , it will be your active chrome profile extension directory.

Extensions, Apps, Themes are located in the same directory.

Difference between single-quoted and double-quoted strings in PHP

Single quotes :

  1. Single quote is little bit faster than double quote because they do not need to be parsed and also use less memory
  2. Everything inside a single quote will be treated as plain string in php.
  3. This method is used when we want the string to be written exactly as it is.
  4. We can’t use variables inside singe quotes. If we use variables inside single quotes then it will output as it is variable name
  5. When  string is specified in single quotes PHP will not evaluate it or  interpret escape characters except single quote with backslash (‘) and  backslash(\) which has to be escaped.

$age = 10;

echo 'Hello \n  \'sample\' my age is $age';

// Hello \n 'sample' my age is $age

Copy and Try this code here

Double quote:

  1. It will display a host of escaped characters (including some regexes), and  variables in the strings will be evaluated.
  2. An important point here is  that you can use curly braces to isolate the name of the variable you want evaluated.
  3. For example let’s say you have the variable $type and you what to echo “The $types are” That will look for the variable $types. To get around this use echo “The {$type}s are” You can put the left brace before or after the dollar sign. Take a look at string parsing to see how to use array variables and such.
  4. Use double quotes in PHP to avoid having to use the period to separate code in string.

$count = 1;
echo " \n The count is $count";
//Output: The count is 1

Copy and Try this code here