• 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: NSUrlConnection doesn't work in NSEventTrackingRunLoopMode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSUrlConnection doesn't work in NSEventTrackingRunLoopMode


  • Subject: Re: NSUrlConnection doesn't work in NSEventTrackingRunLoopMode
  • From: "Erik Sjödin" <email@hidden>
  • Date: Mon, 26 Jun 2006 16:00:50 +0200

Thanks, I couldn't ge the delegations to work in a separate thread so
I solved it by using sendSynchronousRequest (in a separate thread)
instead. It did the trick (and it seems to load faster), though it's
not as flexible as using the asynch approach.

// erik

On 6/26/06, Chris Suter <email@hidden> wrote:


On 26/06/2006, at 9:34 AM, Erik Sjödin wrote:

> I have a NSView that when resized beyond a certain size creates an
> object that initiates a NSURLConnection. The connection is initiated
> but it does not trigger any of its delegates (didReceiveResponse etc)
> until after the viewDidEndLiveResize. I want to download data
> continously while I'm resizing the view but as it is now the download
> doesn't start until after I've stopped resizing the view.
>
> To quote the docs: "For the connection to work correctly the calling
> thread's run loop must be operating in the default run loop mode."  As
> I'm resizing the window I'm in event tracking run loop mode. Is the
> only solution to this behavior to create the nsurlconnection in a new
> thread that always is running in default run mode (I'm trying to do
> this but it doesn't really want to go my way) or is there another
> easier way?
>
> thanks //erik

I think the only way of getting round it is as you say.

I had a similar problem with using a WebView in a modal dialog. I got
around it by using poseAsClass on NSURLConnection and running the
NSURLConnection in a different thread (it ended up being quite
complicated but worked nicely in the end). In your case, it's
considerably simpler to implement. Just stick the NSURLConnection in
a different thread and then if you need stuff to run in the main
thread use performSelectorOnMainThread:... I have read somewhere else
about a hack where you enable period events (which allowed it to work
in different run loop modes) but that had side effects so I wouldn't
recommend it.

There might be a simpler way round all this that Apple know about,
but I've never seen anything published about it.

- Chris
_______________________________________________
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


References: 
 >NSUrlConnection doesn't work in NSEventTrackingRunLoopMode (From: "Erik Sjödin" <email@hidden>)
 >Re: NSUrlConnection doesn't work in NSEventTrackingRunLoopMode (From: Chris Suter <email@hidden>)

  • Prev by Date: [ANN] Article: Exploring Cocoa with F-Script
  • Next by Date: Re: Programmatically toggle display to white on black
  • Previous by thread: Re: NSUrlConnection doesn't work in NSEventTrackingRunLoopMode
  • Next by thread: NSImage bug? NEF Files.
  • Index(es):
    • Date
    • Thread