views:

56

answers:

2

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.

Is 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...

+3  A: 

Have you tried putting something in the

- (void)applicationWillTerminate:(UIApplication *)application

method in your UIApplicationDelegate?

kubi
That's a good idea. I was hoping to have it hit when a specific view gets killed...
Jeffrey Berthiaume
Yup -- that worked. It's kind of a hack (for my app) but that's what I'll use if nobody has any other suggestions...
Jeffrey Berthiaume
+1  A: 

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.

Kendall Helmstetter Gelner