This is a migrated thread and some comments may be shown as answers.

InAppBrowser: issue with redirection and the 'loadstop' event in iOS

6 Answers 862 Views
Report a bug
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
SRD8580
Top achievements
Rank 1
SRD8580 asked on 03 Sep 2013, 03:53 PM
Hi,
I am using the Cordova InAppBrowser plugin in an Icenium project to allow users to "passively" log onto a website.  In order to do this, I am launching a child browser and waiting for the browser to hit the url requested by the application rather than a redirection url such as the logon page, then closing the child browser programatically.

Anyway, I am attaching a handler to the "loadstop" event of the browser reference in order to detect each url loaded into the child browser instance.  On the Simulator and on Android devices, this works perfectly.  However, on an iOS device, we get the following error after any url loads that was the result of an HTTP redirection, and the "loadstop" handler is never called.  I have included a bit of sample JS to demonstrate the issue.

Code:
var windowRef = window.open("https://www.gmail.com", "_blank");

windowRef.addEventListener("loadstop", function (event) {
    console.log("loadstop called on: " + event.url);  //never fires in this case, console shows error below instead
});

Error:
*** WebKit discarded an uncaught exception in the webView:decidePolicyForMIMEType:request:frame:decisionListener: delegate: <NSInvalidArgumentException> -[WebView _canShowMIMEType]: unrecognized selector sent to instance 0x1d5dc850

Note that the loadstop event fires just fine on a "normal" page request that is not the result of redirection.

Additional info:
Icenium 1.7
Cordova 2.7
InAppBrowser Plugin
iPhone 4

Thank you for any information you can provide regarding this issue.

Steve

6 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 04 Sep 2013, 12:46 PM
Hi Steve,

We have not seen this error before and we're using the same code in our sample-facebook-api demo. Do you receive the same error while running the sample on your iOS device? If so, make sure you're running latest iOS version and if necessary reset the device.

Regards,
Steve
Telerik

Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
SRD8580
Top achievements
Rank 1
answered on 04 Sep 2013, 04:02 PM
Thanks for your reply, Steve.  

For reference, I do have iOS 6.1.3 installed and running on the iPhone device.

I tried the facebook sample and while it works, I do get the same error mentioned in my original post in the web console log, but the 'loadstop' event still fires.

It seems the issue might be with the oAuth provider as the gmail logon page from my sample above indicates that it's "loading" indefinitely and never goes away (on iOS).

However, if this is the case, I find it strange that it does finish loading both on Android and the Simulator, and they also do not log the error.

So when you all run the Facebook sample, you do not see the error I mentioned in the web console logs?

Thanks,
Steve
0
Steve
Telerik team
answered on 05 Sep 2013, 09:03 AM
Hello Steve,

After double checking, I do get this error in our sample and it is a bug on our end that I have logged for fixing. For the time being, please set the Build Settings to Release (no livesync) to avoid the error.

Your Telerik points have been updated for bringing this to our attention.

Regards,
Steve
Telerik

Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
SRD8580
Top achievements
Rank 1
answered on 05 Sep 2013, 12:53 PM
Hi Steve,
I changed my build settings to "Release" and everything works as expected, including the 'loadstop' event firing.

Thank you very much for your help getting us past this!

Steve
0
AuctionTrac
Top achievements
Rank 1
answered on 10 Sep 2014, 02:24 PM
I'm having the same issue.  For the life of me, I cannot find where to set to "release" mode.  

I'm wondering if it's the same as turning off Live Sync.  I hope not because I can't seem to do that for iOS unless I forego using AppBuilder and build a full-blown deployable app.  This seems quite cumbersome for simply testing purposes.
0
Tsvetina
Telerik team
answered on 15 Sep 2014, 11:36 AM
Hello Greg,

If you are using the AppBuilder Windows client to build the app, right-click the solution name and select Build Settings. There, you can switch to Release mode.

In Visual Studio, you just need to switch from Debug to Release in the dropdown next to the Start button in the toolbar.

Regards,
Tsvetina
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
Tags
Report a bug
Asked by
SRD8580
Top achievements
Rank 1
Answers by
Steve
Telerik team
SRD8580
Top achievements
Rank 1
AuctionTrac
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or