What is the equivalent for iOS to:
win.close();
var activity = Titanium.Android.currentActivity;
activity.finish();
Thanks!
There isn't (in Titanium). Further, Apple explicitly discourages this:
"An iOS app never displays a Close or Quit option" - Apple, HIG p27 https://developer.apple.com/library/ios/documentation/userexperience/conceptual/mobilehig/MobileHIG.pdf
There are existing SO answers regarding this:
On the iPhone there is no concept of quitting an app. The only action that should cause an app to quit is touching the Home button on the phone, and that's not something developers have access to.
According to Apple, your app should not terminate on its own. Since the user did not hit the Home button, any return to the Home screen gives the user the impression that your app crashed. This is confusing, non-standard behavior and should be avoided.
See existing SO answer here: Proper way to exit iPhone application?
If, after all this, you want a non-standard, will-probably-get-your-app-rejected solution (or if your app isn't destined for the app store, and will be distributed privately through enterprise distribution or personal use), you can create a module that calls [[NSThread mainThread] exit]
.
There is no way to close iOS application using just Titanium SDK. If you really need that you have to create your own small Titanium Module with just one method:
-(id)example:(id)args
{
// example method
exit(0);
return @"Application Exit";
}
However, remember that calling exit()
is strongly not recommended for iOS applications and can lead to rejection from App Store.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With