apache / cordova-plugin-inappbrowser

Apache Cordova InAppBrowser Plugin
https://cordova.apache.org/
Apache License 2.0
1.12k stars 2.15k forks source link

IONIC 5 - IOS - XCODE 13 - InAppBrowser is not installed or you are running on a browser #928

Open rfitoc opened 2 years ago

rfitoc commented 2 years ago

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:

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.

Ionic info

Ionic:

Ionic CLI : 6.2.1 (/usr/local/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/angular 5.6.5 @angular-devkit/build-angular : 0.1102.10 @angular-devkit/schematics : 11.2.10 @angular/cli : 11.2.10 @ionic/angular-toolkit : 3.1.1

Cordova:

Cordova CLI : 10.0.0 (cordova-lib@10.1.0) Cordova Platforms : ios 6.2.0 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 15 other plugins)

Utility:

cordova-res : 0.15.4 native-run : 1.5.0

System:

ios-deploy : 1.10.0 ios-sim : 8.0.2 NodeJS : v14.18.1 (/usr/local/bin/node) npm : 6.14.15 OS : macOS Xcode : Xcode 13.2.1 Build version 13C100

Checklist

rfitoc commented 2 years ago

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.

The most interesting thing is that it worked for me in previous versions of XCODE/IOS. I think that the default "window.open()" works fine in these versions.

Thanks.

me-to-you93 commented 2 years ago

Hello, same problem for me. Resolved downgrading plugin to 4.1.0.