[iOS] App freeze on start

Hey, i currently develope an iOS App with Ionic and get some strange behavior when i deploy it.

First i tested on a iPhone 4s and sometimes the App freeze right after the Splashscreen. I figured out that i maybe got a race condition and try to use plugins that not have been loaded at this time. After some research i manually bootstrap my App ant everything looks fine.

I put this Script add the end of and removed the the ng-app attribute

angular.element(document).ready(function () {
document.addEventListener(‘deviceready’, function () {
angular.bootstrap(document, [‘appName’]);
}, false);
});

This works for me on iPhone 4s and iPhone 5. But when i deploy it to iPhone 5s or higher the App freeze on start. If i switch back to ng-app there are no problems on iPhone 5s and higher.

I get no error logs and have no clue how fo fix it. I appreciate any help.

1 Like

ok, if i wrap the bootstrap with a timeout it works also on iPhone >= 5s

angular.element(document).ready(function(){
window.ionic.Platform.ready(function(){
setTimeout(function(){
angular.bootstrap(document, [‘appName’])
},1000);
});
});

But i don’t understand why. Shouldn’t all plugins already have been loaded when Platform.ready is triggered?

1 Like