Wednesday, March 22, 2023

Getting Ionic 6 to run on iOS 12+


The issue was to get ionic 6 running on an old iOS 12.5.7. 

At the time of writing this, ionic 6.20.9 and capacitor 4 where the latest versions. By rolling back to capacitor 3, it was possible to deploy the app to the old version 12 phone.

The nodejs version used was v18.14.0

Below is the app shown listing the results of scanned devices using cordova-plugin-ble-central plugin.


As described here,  install ionic with:

npm install -g @ionic/cli

ionic --version

6.20.9

Then create a ionic project (Angular was chosen for this project)

ionic start

After the project has been created, remove version 4 of capacitor and install version 3 (https://capacitorjs.com/docs/v3/getting-started) as follows:

npm uninstall @capacitor/ios @capacitor/cli @capacitor/core --save

npm install  @capacitor/ios@latest-3 @capacitor/cli@latest-3 @capacitor/core@latest-3 --save

You should see 3.9.0 when running:

npx cap --version 

3.9.0

Then add the ios platform as described here: https://capacitorjs.com/docs/v3/ios

npx cap add ios

In the ios/App/Podfile file, you should see:

platform :ios, '12.0'

Now, build and deploy the project.

npm run build

npx cap sync

npx cap open ios

To add the plugin run:

npm i cordova-plugin-bluetoothle --save







No comments:

Post a Comment