0

I have an IONIC 5 / cordova project and I use InAppBrowser to open a link.

In the next code:

const browser = this.iab.create(url);

I get error "WARN: InAppBrowser is not installed or you are running on a browser. Falling back to window.open" on execution time in IOS device and IOS emulator.

I have tried all kinds of things that I have found on the internet:

First, I have done many test with @ionic-native/in-app-browser plugin, but I always get the same result:

  • Remove node_modules, www, platform/ios
  • Re-install(remove and install) in-app-browser libraries
  • Recompile in dev and prod mode.
  • Same error..

I have tried it again with the new plugin:

$ ionic cordova plugin add cordova-plugin-inappbrowser 
$ npm install @awesome-cordova-plugins/in-app-browser 
  • I change the code to get the new native plugin

    $ ionic cordova platform add ios

  • BUILD DEVEL and PROD

    $ ionic cordova build ios $ ionic cordova build ios --prod

  • Same result.

I have verified that the cordova plugins are installed in the /Plugins folder of the XCode project.

I have a couple of things to comment on:

Now I use XCode 13, but In XCode 12 works fine. To upgrade the XCode I have upgrade MacOS from Catalina To Monterey.

The only difference between the two projects is that in XCode 13 "Legacy build system" is disabled since it's "deprecated".

I don't know if XCode doesn't import the libraries, I don't know if "Legacy Build System" is necessary. I know nothing... :-(

Can anybody help me?

Thanks.

  • Are you using Ionic with Angular? I had a somehow similar problem when upgrading to Angular 11. See here https://stackoverflow.com/a/69295268/15947768 – Callan Jan 17 '22 at 07:24
  • Yes, it is an angular (11.2.11) project. I have made the change you told me and I still have the same problem. :-( – Ruben Fitó Jan 18 '22 at 06:48
  • I seem that the problem is use it into promise.then() or after await promise... Any idea? – Ruben Fitó Jan 18 '22 at 14:01
  • With capacitor open page window.open of plugin but without promise. It never execute xcode code. With cordova, it don't nothing works. – Ruben Fitó Jan 18 '22 at 14:41

1 Answers1

0

I found the problem.

In my project I have an "Object.prototype" function that it produce a big problem to loop objects.

Referring InAppBrowser pluguin, in file inappbrowser.js:

callbacks = callbacks || {};
for (var callbackName in callbacks) {
    iab.addEventListener(callbackName, callbacks[callbackName]);
}

Perhaps it could be improved with an Object.keys(callbacks), but I think that It was my problem.

Thanks.