Henry
Posts: 0
Joined: Wed Jul 01, 2015 3:59 am

Buttons are broken on Android/iOS

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.

Henry
Posts: 0
Joined: Wed Jul 01, 2015 3:59 am

Buttons are broken on Android/iOS

Its almost like javascript is disabled on the second page.

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Buttons are broken on Android/iOS

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

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Buttons are broken on Android/iOS

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 )

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Buttons are broken on Android/iOS

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

Henry
Posts: 0
Joined: Wed Jul 01, 2015 3:59 am

Buttons are broken on Android/iOS

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.

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Buttons are broken on Android/iOS

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

Henry
Posts: 0
Joined: Wed Jul 01, 2015 3:59 am

Buttons are broken on Android/iOS

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

Henry
Posts: 0
Joined: Wed Jul 01, 2015 3:59 am

Buttons are broken on Android/iOS

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!

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Buttons are broken on Android/iOS

Great news that you found the issue ! Best , Bruce

Return to “Issues”