01 Nov 2009, 22:41
Generic-user-small

Marc Blatt (1 post)

Just curious, can anyone explain why setUpAsynchronousContentLoad messages currentRunLoop in [asyncInputStream scheduleRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; whereas, viewWillDisappear: messages mainRunLoop when removing the stream from the run loop? Without having seen this code, I would have either used currentRunLoop to schedule and remove or mainRunLoop for both. Is this a legacy issue or is there a specific NSStream logic to this discrepancy?

02 Nov 2009, 12:44
Biopic_100x100_pragsmall

Bill Dudney (917 posts)

Hi Marc,

The stream was probably scheduled from the main loop so current == main.

Good luck!

04 Mar 2010, 18:50
Photo_6_pragsmall

Stephen Watson (30 posts)

A good thing I checked as I was going to post exactly that question Marc!

Bill (or whoever!) – two things:

) Why “probably”? (It’s page 152 in iPhone SDK Development, P1.0 printing)

) How would I know when they’re different?

Cheers.

02 Jun 2010, 05:58
Facebookpiccropped_pragsmall

Dallas Hockley (1 post)

Glad I checked here too, but I’m not seeing an explanation. :-( Yes, it’s evident that the cleanup is figuring it’s on the main run loop, but how is that assessment made? If you schedule an async and need to clean it up, is it always on the main? That seems odd. Why not use mainRunLoop in the schedule then? I’m concerned because if you do use “current run loop” in the viewWillDisapper, it crashes hard with and invalid selector.

Anyone figure this out in a deterministic way yet?

  You must be logged in to comment