Re: NSXMLDocument freezes UI
Re: NSXMLDocument freezes UI
- Subject: Re: NSXMLDocument freezes UI
- From: Jesse Grosjean <email@hidden>
- Date: Wed, 29 Aug 2007 09:36:13 -0400
Thanks, that did the trick. I got stuck in the frame of mind that it
was a problem with the xml file. It would have taken me quite a while
to figure this out.
Thanks,
Jesse
On Aug 29, 2007, at 1:21 AM, Steve Shepard wrote:
Hi Jessie,
I was able to reproduce the problem you are seeing here (Intel
10.4.10/Xcode 2.4.1). NSXML bug?
Interestingly, if I edit your code to use the initWithData method, the
problem does not appear.
NSData *data = [NSData dataWithContentsOfURL:[NSURL
fileURLWithPath:pluginPath]];
NSXMLDocument *document = [[NSXMLDocument alloc] initWithData:data
options:0 error:&error];
Note: You'll probably want to set the URI if you use this workaround.
Steve Shepard
Storyist Software
On 8/28/07, Chris Suter <email@hidden> wrote:
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
_______________________________________________
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:
40gmail.com
This email sent to email@hidden
_______________________________________________
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