Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha Premium Member
    Join Date
    Sep 2009
    Posts
    35
    Vote Rating
    5
    Aldri is on a distinguished road

      0  

    Default Sencha touch 2.2 alpha iOS home screen detected as a webview

    Sencha touch 2.2 alpha iOS home screen detected as a webview


    REQUIRED INFORMATION
    Ext version tested:
    • Sencha touch
    Browser versions tested against:
    • iOS6 Safari (iPad mini)
    Description:
    When I require 'Ext.device.Connection' and 'Ext.device.Device' to use the function Ext.device.Connection.isOnline(), it works fine in iOS safari (and on Android), but if I add the app to the home screen I get an error "e is undefined in e.online" in file Ext.device.connection.Sencha in the function onConnectionChange.
    The problem is that the home screen app is detected as a webview, and since it's not a phonegap app it's detected as a sencha webview.
    But it is not a webview, you can't use the sencha device files... The app will get stuck on launcher...


    Steps to reproduce the problem:
    • Require 'Ext.device.Connection' and 'Ext.device.Device'
    • Call Ext.device.Connection.isOnline()
    • Add the app to home screen on iOS
    The result that was expected:
    • Get the navigator.onLine telling you if the device is online or not
    The result that occurs instead:
    • A js error since it's detecting a webview instead of a safari app
    Operating System:
    • iOS 6 on iPad mini

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,227
    Vote Rating
    859
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    The homescreen is a webview. It's not mobile safari or you would see address/navigation bar.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha Premium Member
    Join Date
    Sep 2009
    Posts
    35
    Vote Rating
    5
    Aldri is on a distinguished road

      0  

    Default


    I've just added the url to home screen with the "add to home screen" button in safari, but it's still the same website...
    Even if you consider that this is a webview, I don't think that the javascript error is justified since it makes my app crash and unable to launch...
    I shouldn't call the Sencha wrapper functions if you are not in a sencha webview.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,227
    Vote Rating
    859
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    I don't call it a webview, apple does. It uses the same webview as if you were to create your own native app and use a webview to display a site.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User
    Join Date
    Dec 2010
    Posts
    23
    Vote Rating
    0
    francescosyd is on a distinguished road

      0  

    Default


    I'm getting the same issue on the iPhone 5. I found that even though a bookmarked app on IOS6 uses a webview control it doesn't have the same system access privileges as a webview control embedded in an app and deployed to the app store.

    It appears that in the Sencha Touch 2.2 code all the Ext.device.* classes return an Ext.device.*.Sencha type because a webview control is detected. This causes a bookmarked app on an IOS6 device to crash.

    A simple check to see if the app is in a webview and a sencha app can resolve this issue. In all the constructors of the Ext.devive.* classes I've changed the code to check for a sencha app. If the app is in a webview control but not a sencha app then return Ext.device.*.Simulator (just like what would happen when accessing the app via a browser) Eg:

    Code:
    Ext.define('Ext.device.Connection', {
        singleton: true,
    
    
        requires: [
            'Ext.device.Communicator',
            'Ext.device.connection.Sencha',
            'Ext.device.connection.PhoneGap',
            'Ext.device.connection.Simulator'
        ],
        
        /**
         * @event onlinechange
         * @inheritdoc Ext.device.connection.Sencha#onlinechange
         */
    
    
        constructor: function() {
            var browserEnv = Ext.browser.is;
    
    
            if (browserEnv.WebView) {
                if (browserEnv.PhoneGap) {
                    return Ext.create('Ext.device.connection.PhoneGap');
                }
                else if (browserEnv.Sencha) {
                    return Ext.create('Ext.device.connection.Sencha');
                }else{
                	return Ext.create('Ext.device.connection.Simulator');
                }
            }
            else {
                return Ext.create('Ext.device.connection.Simulator');
            }
        }
    });

    Not sure if this is an oversight by Sencha or by design. What do you think Mitchell?

    cheers

    Francesco