nsrunloop

Multiple NSURLConnection & NSRunLoop

Hi, I am trying to speed up my application download speed. I used Asynchronous NSURLConnection to download contents from the server, it was working fine with one connection. I use the code from this post to implement multiple delegate objects. http://stackoverflow.com/questions/203294/multiple-nsurlconnection-delegates-in-objective-c ...

Foundation tool OS X Service, Garbage Collection, MacRuby: why my NSRunLoop won't loop in acceptInputForMode:beforeDate:?

I'm writing an OS X Service with MacRuby. It upcases the selected text. It mostly works, but… well, here's all of it: #!/usr/local/bin/macruby # encoding: UTF-8 framework 'Foundation' framework 'AppKit' class KCUpcase def upcase(pasteboard, userData: s_userdata, error: s_error) incoming_string = pasteboard.stringForType "public.u...

Why is my application terminating in the middle of unit tests?

The Problem I run my unit tests. At one point, I wait using: [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]]; for an NSOperationQueue to be empty. When my app reaches this line, it terminates immediately. It's run this exact same line with other tests. All tests were working perfectly recently. It al...

Looping a CFRunLoopSource

Here is the source files I'm currently developing. The idea behind this class is to contain a target object and selector which will be invoked in whatever CFRunLoop passed to scheduleInCFRunLoop. I need this to loop repeatedly without consuming all available processing time on the iPhone. Any help on completion will be most helpful, I've...

NSRunLoops in Cocoa?

Hi guys, Let's say I have 2 threads, one is the main thread and another one, a secondary thread. The main thread is being used the most, but sometimes (rarely) I want the secondary thread to do some work based on calls from the main thread. Most of the time the secondary thread should sleep. Now after some searching I understand the wa...

NSRunLoop cancelPerformSelectorsWithTarget's not working

Hey guys, I have this following code and I am not getting the results I expected. #import "CancelPerformSelectorTestAppDelegate.h" @implementation CancelPerformSelectorTestAppDelegate @synthesize window; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [window makeK...

StatusItem menu blocks main thread when it's opened. Workaround?

I've written an app for the Mac that is designed as a status bar item. However, when a user opens its menu from the status bar, the main run loop is blocked until it's closed. Since this app responds to messages on a socket, it's a problem that it can't do anything while the menu is open. I've tried setting the status item from a separa...

How to send selectors or blocks to an NSRunLoop to perform?

I need to guarantee that the same thread performs various actions at arbitrary times. First the thread needs to initialize a library, then I want the thread to sleep until work needs to be done and upon user input, I need to be able to pass selectors or blocks for execution. How can I setup an NSRunLoop to sleep after initialization? Af...

Runloop works on simulator fails on device

I have an iPod Touch 2nd generation and I'm trying to retrieve a photo from the assets library by using the photo name. I ran restore on the device to make sure it is factory 4.1. My header file has: #import <AssetsLibrary/AssetsLibrary.h> { BOOL fetching; } @property BOOL fetching; typedef void (^ALAssetsLibraryAssetForURLResu...

NSThread detachNewThreadSelector???? uh?

Hi, I was looking through the Threading Programming which I have to say it's really good. Specially I was looking on How to configure Port-based input sources for running loops. And I see this piece of code // Detach the thread. Let the worker release the port. [NSThread detachNewThreadSelector:@selector(LaunchThreadWithPort:) ...