• 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
WebView question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

WebView question


  • Subject: WebView question
  • From: Matt Mashyna <email@hidden>
  • Date: Thu, 9 Feb 2006 17:10:18 -0500
  • Spam: If the email is for spam, please report to email@hidden -By mail relay service at: http://www.dnsExit.com/Direct.sv?cmd=mailRelay Accounts will be suspended immediately if found spamming.

I have a window with a WebView in it. When the app loads I can tell it's controller to load it and open a url in applicationDidFinishLaunching.

Works fine. I can change to that window any time and click links etc. but I don't want to open this window at launch time. The app is a sort of wizard that goes through steps and has a few threads doing things like connecting to http and ftp servers. When the steps are complete, I want to pop up the window with the WebView and tell it to load a specific URL that might not be known until right before it's needed to load. When I try to load a URL later -- one that works fine when done in applicationDidFinishLaunching -- nothing happens. I don't get an exception.

When I try opening a URL from another thread it also fails quietly. Something is wrong with the way I want to load it. Do you have to make calls to webkit from the main thread ?

Here's the only method from my controller object (NSWindowController subclass) I have to open a URL:

- (void) loadWebPage:(NSString *)page
{
[[myWebView mainFrame] loadRequest: [NSURLRequest requestWithURL: [NSURL URLWithString: page]]];
NSLog(@"Loading %@", page);
} // loadWebPage


I call loadWebPage from a thread like so:

- (void) showWebPage:(id) object
{
	NSAutoreleasePool*	pool = [[NSAutoreleasePool alloc] init];

browserController = [[WebController alloc] initWithWindowNibName: @"WebView"];
[browserController showWindow: self];
[browserController loadWebPage: [settings objectForKey: @"postDeliveryBrowserPage"]];

while(! userCanceled)
{
[NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow: 0.2]]; // sleep a little
}


	[pool release];
} // showWebPage

And finally from applicationDidFinishLaunching I launch the thread like this:
[NSThread detachNewThreadSelector:@selector(showWebPage:) toTarget:self withObject:nil];



Any ideas about what I'm doing wrong ?

Thanks,
Matt
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: WebView question
      • From: glenn andreas <email@hidden>
  • Prev by Date: Re: Using zlib for i386 (or Universal) builds on PPC clients
  • Next by Date: Re: NSView no longer visible notification?
  • Previous by thread: Re: Calling TransitionWindowWithOptions on a WindowRef returned from a [NSWindow windowRef]
  • Next by thread: Re: WebView question
  • Index(es):
    • Date
    • Thread