Re: NSXMLDocument freezes UI
Re: NSXMLDocument freezes UI
- Subject: Re: NSXMLDocument freezes UI
- From: Chris Suter <email@hidden>
- Date: Wed, 29 Aug 2007 13:48:37 +1000
On 29/08/2007, at 4:32 AM, Jesse Grosjean wrote:
I'm seeing a really odd problem. If I put this code in my delegate:
- (void)applicationWillFinishLaunching:(NSNotification *)
aNotification {
NSError *error = nil;
NSXMLDocument *document = [[NSXMLDocument alloc]
initWithContentsOfURL:[NSURL fileURLWithPath:@"/Users/jessegrosjean/
Desktop/plugin.xml"] options:0 error:&error];
}
Hi Jesse,
I believe the problem you have is with loading the file.
NSURLConnection uses threads and unfortunately, NSApplication doesn't
like it if you start threads in applicationWillFinishLaunching (it's
fine a bit later on).
As a workaround you could try using -[NSData dataWithContentsOfURL:]
which I believe won't cause new threads to be spawned and then pass
the result to -[NSXMLDocument initWithData:…].
- Chris
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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