-
Notifications
You must be signed in to change notification settings - Fork 3
iOS Caveats
Apple forbids certain behavior inside the App Store, for this reason we detect if the app has been signed by Apple and disable calls to functions that Apple doesn't like. The following features will be disabled automatically when submitted for App Store approval.
- Authentication Checking & KillSwitch
###Differences in Event Behavior
While Phonegap tries to make itself as platform agnostic as possible, there are a few things that iOS does differently that you'll have to watch out for. For example:
In the pause handler, any calls that go through Objective-C will not work, nor will any calls that are interactive, like alerts. This means that you cannot call console.log (and its variants), or any calls from Plugins or the PhoneGap API. These will only be processed when the app resumes (processed on the next run-loop).
-From Phonegap's official documentation
This alone causes some very unwanted behavior when using native plugins. Functions that should be called when an app is closed are actually called when an app is opened again. This makes starting and ending sessions in particular all but impossible without the iOS-specific eventlisteners active
and resign
:
document.addEventListener("deviceready", startAppBladeSession, false);
document.addEventListener("active", startAppBladeSession, false);
document.addEventListener("resign", endAppBladeSession, false);
function startAppBladeSession(){
plugins.appBlade.startSession();
};
function endAppBladeSession(){
plugins.appBlade.endSession();
};
It's important to keep track of whatever quirks your version of PhoneGap has on whatever platform you choose to build.