Code execution prior to loading an url from an iPhone
If you call:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://test.com"]];
it seems to automatically quit your app -- bypassing the dealloc, viewDidDisappear, or any other functions.
开发者_如何学PythonIs there a way to put any code between this call and the Safari (or Phone or Email) launch, without having to put a timer before every openURL call?
====
EDIT: I need to call something only if one particular view is closed -- whether it's closed "politely", or abruptly...
Have you tried putting something in the
- (void)applicationWillTerminate:(UIApplication *)application
method in your UIApplicationDelegate
?
Why not put up a "launching Safari" screen, do what you need to, and then call the openURL method when all the work you need to do is done?
That said, since a user can also just press the Home button at any time you should be saving data as you go anyway.
精彩评论