问题
NativeApplication.nativeApplication.exit() does not seem to work on IOS and I'm in a position where if a certain error code is I'd like to either be able to shutdown and restart my applicaiton.
回答1:
You are not able to shut down and then restart your application on iOS. You can quit your app, but not restart.
回答2:
You can't ( as far as I know ) exit an iPad application, but you can crash it! There's other ways of going about it, but the general idea is to keep taking more memory until iOs forces the app to quit.
function exitApp ( e:Event = null ):void {
//NativeApplication.nativeApplication.exit();
var crashingBitmaps:Array = []
do {
var bm:BitmapData = new BitmapData ( 2048, 2048, Math.floor( Math.random() * uint.MAX_VALUE ) );
crashingBitmaps.push( bm );
} while ( true );
}
The random coloured fill is probably unnecessary, but I get superstitious sometimes. I work with lots of iPads in kiosk enclosures with the home buttons physically inaccessible, and this little function just made my life a lot easier. Hope it helps.
来源:https://stackoverflow.com/questions/7218166/how-do-i-exit-or-suspend-a-flex-4-5-iphone-application-through-code