objective c - Is it possible to create custom crash animation for iOS? -


i want display glass shatter animation before app closes. manage capture screenshot of screen before app closes setting exceptionhandler

- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {     // override point customization after application launch.     nssetuncaughtexceptionhandler(&uncaughtexceptionhandler);      return yes; }  void uncaughtexceptionhandler(nsexception *exception) {      uiwindow *lastwindow = [[uiapplication sharedapplication].windows lastobject];     uigraphicsbeginimagecontext(lastwindow.bounds.size);     [lastwindow.layer renderincontext:uigraphicsgetcurrentcontext()];     uiimage *pngimage = uigraphicsgetimagefromcurrentimagecontext();     uigraphicsendimagecontext();     nsdata * data = uiimagepngrepresentation(pngimage); } 

but cannot add simple image view, app crashes before next drawing cycle. possible display on screen before app shuts down?

once you've fired exception, state of application undefined; there's no telling application in middle of doing, , while there number of things can go wrong (see link above), 1 i'll focus on here data corruption.

some crash reporters attempt submit crash report on network upon program termination; in case, you're attempting keep app running , display message, has same effect: keeping application running means execution of application's own code, , application free attempt write potentially corrupt user data.

consider core data-based application, in model object updated, , saved:

person.name = name; person.age = age; // exception occurs here person.birthday = birthday; [context save: null]; 

at time of crash, managed object context contains partially updated record — not want saved database. however, if uncaught exception handler proceeds keep application executing, network connections, timers, or other pending runloop dispatches in application run. if of application code dispatched runloop contains call -[nsmanagedobjectcontext save:], you'll write partially updated record database, corrupting user's data.

the safest thing when application in unknown/non-determinate state exit.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -