Page 1 of 1

Buttons are broken on Android/iOS

Posted: Wed Jan 20, 2016 4:32 am
by Henry

I have a two page document, a start page and a secondary page.

One the start page, all button operations work. Specifically, page navigation and opening a popup.

However on the second page; none of the buttons work.

I used the weinre debugger and my conclusion is that the buttons do work, however the events that they trigger do not. For example running Apperio.navigateTo('FirstPage') does not work on the second page but Apperyio.navigateTo('SecondPage') does work on the first page.

I have tried various settings and even changing the backend libraries.

I have also tried 'Multi- Page Jquery template' on and off.

All functionality however does work in test browser. Only on an Android tablet and iOS ipad are the functions broke. However, these are the two platforms which I require it work on.

Any help would be very appreciated.


Buttons are broken on Android/iOS

Posted: Wed Jan 20, 2016 6:00 am
by Henry

Its almost like javascript is disabled on the second page.


Buttons are broken on Android/iOS

Posted: Wed Jan 20, 2016 6:51 am
by Bruce Stuart

I have the same problems with navigation events ... Some events actually cause my app to crash. I have resorted to creating a function that I call fPageOpen .. It has the same Parms as the appery event .. However when I call it ... ( the Appery event ) I complete the rest of the parameters that are allowed to be passed to the event ... Which are the same as the jquery event ... see the jquery docs for changepage event ... And look at supplying the hash parameter with False. This disables any back button events but has the large benefit of having you app actually work and not crash :-)

If this is too generic ... And you need a code example ... Let me know i can supply the code in the morning when I'm back at my desk ( I'm in Us west coast time zone gmt -8 )

Bruce


Buttons are broken on Android/iOS

Posted: Wed Jan 20, 2016 6:56 am
by Bruce Stuart

Ps... I made this change based on posts on and about events which trigger errors in the debugger including but not limited to resetting plugins due to page load ( I found those events and warnings in my iOS simulator sessions ) and failed to load page ( page not found errors ) also in the iOS simulator ( Xcode ). You might try running your app via the Xcode simulator and see if you get those same errors and in which case ... The fix I note above should work )


Buttons are broken on Android/iOS

Posted: Wed Jan 20, 2016 7:17 am
by Bruce Stuart

borrowing laptop... here's my code...

replace your calls to Appery.navigateTo( 'yourpagename' ) with

fOpenPage( 'yourpagename' );

in a new Javascript asset place this code.... (Create new - Javascript - from the IDE )...

function fOpenPage( sPageName ) {
try {
Apperyio.navigateTo( sPageName.trim() , {transition: 'slidedown',
reverse: false, changeHash: false, dataUrl: undefined, reloadPage: false, role: undefined , allowSamePageTransition : false });
return true ;
} catch (e) {
// the page load failed.... inform user and recall ...
alert('Failed to load page due to network error - please re-try');
console.log( e );
return false ;
}

}

.... note - the try and catch loop was a failed attempt at trying to get the app to tell me what was happening when I attempted to change pages and either got an infinite loop, a crash out to the inapp browser or an app that hung. You don't absolutely need it. (the try - catch loop) .... but you never know....

no guarantees this will fix your problem - but you can eliminate this fix from your list if it does not work. PS - I had the same symptom though - worked great in the browser - failed in the app.

best,

Bruce


Buttons are broken on Android/iOS

Posted: Wed Jan 20, 2016 11:11 pm
by Henry

Hey Bruce!

Thank you for the code snippet. fOpenPage page transition was definitely smoother than the standard transition. However, javascript on the second page still appears to be malformed.

Regards,

Henry.


Buttons are broken on Android/iOS

Posted: Wed Jan 20, 2016 11:28 pm
by Bruce Stuart

If you run your code in the iOS simulator Xcode ... What errors do you see in the console ??


Buttons are broken on Android/iOS

Posted: Thu Jan 21, 2016 12:25 am
by Henry

I found this using internet explorer, a legacy platform. However I suspect it is the same error source as in iOS and Android. It is a problem with jquery.

File: jquery-2.1.1.js, Line: 330, Column: 5

Expected ':'

Here is the relevant code snippet.
code
if ( code ) {
// If the code includes a valid, prologue position
// strict mode pragma, execute code by injecting a
// script tag into the document.
if ( code.indexOf("use strict") === 1 ) {
script = document.createElement("script");
script.text = code;
document.head.appendChild( script ).parentNode.removeChild( script );
} else {
// Otherwise, avoid the DOM node creation, insertion
// and removal by using an indirect global eval
330: indirect( code );
}
}
},

/code


Buttons are broken on Android/iOS

Posted: Thu Jan 21, 2016 2:22 am
by Henry

The problem ended up being that I had custom javascript that would run in a modern environment (Testing Browser and Chrome on Android) but would outright fail on iOS and Android as Native.

Specifically,

code

Apperyio&#46;storage&#46;SomeVariable&#46;set({Header, LineArray}); <--- Would Fail on iOS/Android

Apperyio&#46;storage&#46;SomeVariable&#46;set({'Header':Header, 'LineArray':LineArray}) <-- Works&#46;

/code
Thanks Anyway Bruce!


Buttons are broken on Android/iOS

Posted: Thu Jan 21, 2016 5:31 am
by Bruce Stuart

Great news that you found the issue ! Best , Bruce