• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
knowing when WebView is done
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

knowing when WebView is done


  • Subject: knowing when WebView is done
  • From: Timothy Ritchey <email@hidden>
  • Date: Thu, 05 Jun 2008 13:54:51 -0400

I am trying to use a WebView to render a page in order to create a thumbnail for a CoreData managed entity. I have a custom NSManagedObject subclass WebSiteManagedObject with a setUrl: that calls:

NSRect rect = NSMakeRect(0, 0, 900, 1164);
webView = [[WebView alloc] initWithFrame:rect frameName:@"thumbnail" groupName:nil];
[webView setFrameLoadDelegate:self];
[webView setMainFrameURL:value];


My WebSiteManagedObject is setup as the delegate, and I track the icon, title and frame load messages. I need to know when it is safe to cleanup the WebView, but I can't seem to deterministically figure out when the WebView is actually done from the delegate calls. I assumed that webView:didFinishLoadForFrame: would be the final delegate call, which it often is, but periodically, I get webView:didReceiveTitle: after the last didFinishLoadForFrame: (in all cases, it seems to be related to redirects).

Does anyone know a good way to determine when the WebView is REALLY done so I can release it? I've included the delegate implementations below. Thanks for any advice. (I realize my approach may be fundamentally flawed as well).


- (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame
{
if(frame == [sender mainFrame]) {
[self setValue:title forKey:@"title"];
}
}


- (void)webView:(WebView *)sender didReceiveIcon:(NSImage *)image forFrame:(WebFrame *)frame
{
if(frame == [sender mainFrame]) {
[self setValue:[image TIFFRepresentation] forKey:@"favicon"];
}
}


- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
{
if(frame == [sender mainFrame]) {


	...

        [self setValue:[image TIFFRepresentation] forKey:@"thumbnail"];
        [sender autorelease];
    }
}


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: CATextLayer question
  • Next by Date: Re: Getting rid of specific "May not respond" messages
  • Previous by thread: NSKeyPathExpression and message was received but not handled?
  • Next by thread: Re: knowing when WebView is done
  • Index(es):
    • Date
    • Thread