WuglyakBolgoink / cordova-plugin-iroot

Cordova Jailbreak/Root Detection Plugin for Apache Cordova
MIT License
35 stars 72 forks source link

Capacitor IOS IRoot is undefined #52

Closed ilpert closed 3 years ago

ilpert commented 3 years ago

Hello,

i am trying to implement this plugin inside an ionic angular project and i'm facing some issue.

Due to the capacitor difference between cordova i've added the plugin via:

npm install cordova-plugin-iroot
npx cap sync

And i'm accessing it's functionality via

import { Plugins } from '@capacitor/core';
const { IRoot } = Plugins;

      IRoot.isRooted(
        booleanVal => {
          console.log('IRoot.isRooted success: ', booleanVal);
        },
        err => {
          console.log('IRoot.isRooted error:', err);
        }
      );

When i open the app in the browser, IRoot show me the error "IRoot does not have web implementation" and i'll take it as a good sign because it seems that is implemented.

When i open the simulator or the app, when i do the check inside the platform ready, IRoot return as undefined and nothing happens.

Someone has faced the same issue?

How can i resolve this problem?

Thanks

ilpert commented 3 years ago

Hi, i've found that if i do:

declare const IRoot: any;

instead of adding it via capacitor

import { Plugins } from '@capacitor/core'; const { IRoot } = Plugins;

is working fine.

I don't know why the first time it wasn't working for me.

The issue is closed for me, thanks @WuglyakBolgoink