I have a document based application
and when the application is closed, I need to load a url in a web browser. It's working fine, except that the NSDocument
closes before this page can be loaded.
I would need it to wait 200 ms
and then close the document.
I have found the NSTerminateLater
but that is referred to the application, not the document. How can i do this?
this is what i have for now:
- (id)init
{
self = [super init];
if (self) {
_statssent = NO;
// Observe NSApplication close notification
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(_sendstats)
name:NSApplicationWillTerminateNotification
object:nil];
}
return self;
}
- (void)_sendstats
{
if (!_statssent)
{
_statssent = YES;
if (hasuploaded == 1)
{
[self updatestatsUploads:0 progloads:1];
}
}
}
- (void)close
{
[self _sendstats];
[super close];
}