• 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
Re: NSXMLDocument freezes UI
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSXMLDocument freezes UI


  • Subject: Re: NSXMLDocument freezes UI
  • From: "Steve Shepard" <email@hidden>
  • Date: Tue, 28 Aug 2007 22:21:25 -0700

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:
>
> 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

  • Follow-Ups:
    • Re: NSXMLDocument freezes UI
      • From: Jesse Grosjean <email@hidden>
References: 
 >NSXMLDocument freezes UI (From: Jesse Grosjean <email@hidden>)
 >Re: NSXMLDocument freezes UI (From: Chris Suter <email@hidden>)

  • Prev by Date: Re: How to create Hypertext in cocoa applications?
  • Next by Date: Re: NSXMLDocument Crashing
  • Previous by thread: Re: NSXMLDocument freezes UI
  • Next by thread: Re: NSXMLDocument freezes UI
  • Index(es):
    • Date
    • Thread