How do I exit (or suspend) a Flex 4.5 IPhone Application through code?

安稳与你 提交于 2020-01-15 23:41:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!