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

7 posts, 0 answers
  1. SRD8580
    SRD8580 avatar
    3 posts
    Member since:
    Oct 2006

    Posted 03 Sep 2013 Link to this post

    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
  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 04 Sep 2013 Link to this post

    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.
  3. SRD8580
    SRD8580 avatar
    3 posts
    Member since:
    Oct 2006

    Posted 04 Sep 2013 Link to this post

    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
  4. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 05 Sep 2013 Link to this post

    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.
  5. SRD8580
    SRD8580 avatar
    3 posts
    Member since:
    Oct 2006

    Posted 05 Sep 2013 Link to this post

    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
  6. AuctionTrac
    AuctionTrac avatar
    5 posts
    Member since:
    Apr 2013

    Posted 10 Sep 2014 in reply to SRD8580 Link to this post

    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.
  7. Tsvetina
    Admin
    Tsvetina avatar
    1876 posts

    Posted 15 Sep 2014 Link to this post

    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.

     
Back to Top