Unfortunately this only works when I afterwards enter this runloop
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
while(!terminated) {
if (![[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:[NSDate dateWithTimeIntervalSinceNow:100000]]) {
break;
}
[pool release];
pool = [[NSAutoreleasePool alloc] init];
}
[pool release];
(the connectionDidFinishLoading:/connection:didFailWithError:
terminates the above loop)
Now I am a bit surprised. Shouldn't runModalForWindow: do pretty much
the same thing? The documentation states
"By default, for the connection to work correctly the calling thread’s
run loop must be operating in the default run loop mode. See
scheduleInRunLoop:forMode: to change the runloop and mode."
But I am a bit lost what to do with that information. I would assume
that
...but I would like to understand the "why". Do I really have to spawn
another thread for this? Or is it OK to process the run loop like
shown above? I have the feeling I am somehow fighting the framework
again here.