Problem with Secure Storage plugin missing on iOS

I am having an issue with the SecureStorage Cordova plugin on iOS. I want to set an item to store for later use I found that when I go to login it just sits there frozen.

The code works fine on Android and Browser platforms but iOS it just hangs. I tried in the emulator and on a physical device both have same issue.

What I have done is go from ionic-native 3.6.1 to 3.10.2 and uninstalled the secure-storage plugin from cordova and re-added it. I was thinking that there might have been an update which I did see a update in version 3.9.0.

secure-storage: reject the promise if the plugin doesn’t exist (#1562) (d5919d1)

When I run ionic cordova emulate ios -c I see this:

[17:39:07] console.warn: Native: tried accessing the SecureStorage plugin but it’s not installed.
[17:39:07] console.warn: Install the SecureStorage plugin: ‘ionic plugin add cordova-plugin-secure-storage’
[17:39:07] console.log: Angular is running in the development mode. Call enableProdMode() to enable the production mode.
[17:39:07] console.log: plugin_not_installed

I have already installed the secure storage plugin. I double check and clear enough it says it already exists.

Ionic cordova plugin add cordova-plugin-secure-storage
cordova plugin add cordova-plugin-secure-storage --save
:heavy_check_mark: Running command - done!
Plugin “cordova-plugin-secure-storage” already installed on android.
Plugin “cordova-plugin-secure-storage” already installed on browser.
Plugin “cordova-plugin-secure-storage” already installed on ios.
Adding cordova-plugin-secure-storage to package.json
Saved plugin info for “cordova-plugin-secure-storage” to config.xml

Any help would be greatly appreciated.

Paste your ionic cordova plugin list output and package.json content.

I would try removing the iOS platform and add it back again. This sometimes fixes stuff.

I was curious about the dependencies of ionic-native with ionic-angular. Does it matter that I am currently running 3.10.2? Or would it be better to roll back to 3.6.1, which I see as the official version attached with 3.3.0 ionic-angular release notes.

I have tried removing and re-adding the iOS platform and it still gets the same error using ionic native 3.10.2 and cordova secure storage plugin 2.6.7.

Here is the output:

cordova plugin ls
:heavy_check_mark: Running command - done!
cordova-plugin-camera 2.3.1 “Camera”
cordova-plugin-compat 1.1.0 “Compat”
cordova-plugin-console 1.0.5 “Console”
cordova-plugin-device 1.1.4 “Device”
cordova-plugin-google-analytics 1.7.11 “Google Universal Analytics Plugin”
cordova-plugin-nativestorage 2.2.2 “NativeStorage”
cordova-plugin-screen-orientation 1.4.2 “Screen Orientation”
cordova-plugin-secure-storage 2.6.7 “SecureStorage”
cordova-plugin-splashscreen 4.0.2 “Splashscreen”
cordova-plugin-statusbar 2.2.1 “StatusBar”
cordova-plugin-whitelist 1.3.1 “Whitelist”
cordova-sqlite-storage 2.0.4 “Cordova sqlite storage plugin”
ionic-plugin-keyboard 2.2.1 “Keyboard”

package.json:

{
“name”: “app”,
“author”: “firstname lastname”,
“homepage”: “websiteURL”,
“private”: true,
“scripts”: {
“clean”: “ionic-app-scripts clean”,
“build”: “ionic-app-scripts build”,
“ionic:build”: “ionic-app-scripts build”,
“ionic:serve”: “ionic-app-scripts serve”
},
“dependencies”: {
@angular/common”: “4.1.2”,
@angular/compiler”: “4.1.2”,
@angular/compiler-cli”: “4.1.2”,
@angular/core”: “4.1.2”,
@angular/forms”: “4.1.2”,
@angular/http”: “4.1.2”,
@angular/platform-browser”: “4.1.2”,
@angular/platform-browser-dynamic”: “4.1.2”,
@ionic-native/camera”: “3.10.2”,
@ionic-native/core”: “3.10.2”,
@ionic-native/google-analytics”: “3.10.2”,
@ionic-native/screen-orientation”: “3.10.2”,
@ionic-native/secure-storage”: “3.10.2”,
@ionic-native/splash-screen”: “3.10.2”,
@ionic-native/status-bar”: “3.10.2”,
@ionic/storage”: “^2.0.1”,
@ng-idle/core”: “2.0.0-beta.11”,
@ng-idle/keepalive”: “2.0.0-beta.11”,
“cordova-android”: “^6.2.3”,
“cordova-browser”: “^4.1.0”,
“cordova-ios”: “^4.4.0”,
“cordova-plugin-camera”: “2.3.1”,
“cordova-plugin-console”: “1.0.5”,
“cordova-plugin-device”: “1.1.4”,
“cordova-plugin-google-analytics”: “1.7.11”,
“cordova-plugin-nativestorage”: “2.2.2”,
“cordova-plugin-screen-orientation”: “1.4.3”,
“cordova-plugin-secure-storage”: “^2.6.7”,
“cordova-plugin-splashscreen”: “4.0.3”,
“cordova-plugin-statusbar”: “2.2.1”,
“cordova-plugin-whitelist”: “1.3.1”,
“cordova-sqlite-storage”: “^2.0.4”,
“ionic-angular”: “3.3.0”,
“ionic-plugin-keyboard”: “2.2.1”,
“ionicons”: “3.0.0”,
“rxjs”: “5.1.1”,
“sw-toolbox”: “3.6.0”,
“zone.js”: “0.8.10”
},
“devDependencies”: {
@ionic/app-scripts”: “1.3.7”,
@ionic/cli-plugin-cordova”: “1.2.1”,
@ionic/cli-plugin-ionic-angular”: “^1.2.0”,
“typescript”: “2.2.1”
},
“cordovaPlugins”: [
“cordova-plugin-whitelist”,
“cordova-plugin-console”,
“cordova-plugin-statusbar”,
“cordova-plugin-device”,
“cordova-plugin-splashscreen”,
“ionic-plugin-keyboard”
],
“cordovaPlatforms”: ,
“description”: “long sentence here.”,
“cordova”: {
“plugins”: {
“cordova-plugin-camera”: {},
“cordova-plugin-console”: {},
“cordova-plugin-device”: {},
“cordova-plugin-google-analytics”: {},
“cordova-plugin-nativestorage”: {},
“cordova-plugin-screen-orientation”: {},
“cordova-plugin-splashscreen”: {},
“cordova-plugin-statusbar”: {},
“cordova-plugin-whitelist”: {},
“ionic-plugin-keyboard”: {},
“cordova-sqlite-storage”: {},
“cordova-plugin-secure-storage”: {}
},
“platforms”: [
“android”,
“browser”,
“ios”
]
}
}

That should make no difference.

Your error message is complaining about missing the native Cordova plugin cordova-plugin-secure-storage - which seems to be installed.

Can you look into the generated /ios folder in /platforms to see if the plugin is copied inside there?
How exactly are you building your iOS app? Are other changes reflected correctly after building?

Other changes are reflected correctly after being built. I have added a screenshot of my workspace showing that the platforms/ios/platform_www/plugins/cordova-plugin-secure-storage does exist and has a securestorage.js file.

I build doing ionic cordova build ios.

Here is the generated the other directory of the app’s generated xcode project has the plugin as well.

Okay I fixed it. Stupid on my part. When I initially set the secure storage create() call I didn’t wrap it in a deviceready promise.

1 Like