0

I am using two plugins (cordova-plugin-auth-dialog & cordova-inappbrowser) to realize the login process for my cordova ios app.

The login itself is working really fine on the iPhone, but on the iPad it is causing a long UI freeze (CPU usage at 99% for about 1minute). It must be caused by the login, since the app is working whenever you are logged in.

In Xcode I can see also the famous

THREAD WARNING: ['InAppBrowser'] took '52.126953' ms. Plugin should use a background thread.

warning. Is this really significant ?

I am using the latest version of cordova and the version 4.1.0 of the ios platform.

Do you guys have any tips for me ? I also would really like to have some approaches to debug the issue with some external tools (Safari Debugger, does not really have any useful information for me there).

Thanks in advance !

EDIT : Added Code

authDialog.authenticate(URL_TO_LOGIN, function () {
   console.log("success");
   var inAppBrowserRef = cordova.InAppBrowser.open(URL_TO_LOGIN, '_blank', 'location=yes,hidden=yes');
   inAppBrowserRef.addEventListener('loadstart', loadStartCallBack);
   inAppBrowserRef.addEventListener('loadstop', loadStopCallBack);
   inAppBrowserRef.addEventListener('loaderror', loadErrorCallBack);
     defer.resolve();
   }, function (error) {
     console.log("error xxx:", error);
     defer.resolve();
   }, username, password);
belafarinrod91
  • 323
  • 7
  • 17
  • how you use inappbrowser in your code for open page? Please update code in your question – Naitik Jul 14 '16 at 11:09
  • @naitik added the code snippet – belafarinrod91 Jul 14 '16 at 12:17
  • ok you can use " window.open(URL_TO_LOGIN, "_blank"); " instead of " cordova.InAppBrowser.open(URL_TO_LOGIN, '_blank', 'location=yes,hidden=yes'); " Try with it and let me know result. – Naitik Jul 14 '16 at 12:22
  • @Naitik: Its a little bit faster already - thank you. But I need to add "hidden=yes", so that the window is not visible to the enduser. I guess this request is blocking the ui somehow ... – belafarinrod91 Jul 14 '16 at 12:46
  • so you can remove hidden= yes and try for test will it better performance or not. – Naitik Jul 14 '16 at 12:56
  • So the performance is really good, when I remove the "hidden=yes" and when I close the new window directly after it opens. But when I add the flag again, the performance is really bad again. – belafarinrod91 Jul 14 '16 at 13:11
  • SO what is your problem now? is it working as you expected or wnat to do more analysis? – Naitik Jul 14 '16 at 13:15
  • I was able to resolve this issue with your help and the information from this post : http://stackoverflow.com/questions/15666258/phonegap-build-open-external-page-in-inappbrowser-or-childbrowser-with-no-tool Thank you again ! – belafarinrod91 Jul 14 '16 at 14:19
  • Glad to help you... Cheerss... – Naitik Jul 14 '16 at 15:44

1 Answers1

0

The following snippet might help you.

setTimeout(function(){ _self.openUrl(url) },300);

Lokesh G
  • 831
  • 11
  • 19