0

(UPDATED)

It seems that Apple's version of unit-testing (the SenTest framework) uses a CFRunLoop instead of the standard NSRunLoop - which is only partially toll-free-bridged.

This causes certain classes - in particular: any networking - to receive different callbacks than they would with the normal NSRunLoop.

So ... is there a way to replace the CFRunloop with an NSRunLoop?


Concrete example: you cannot run any of Amazon S3 networking in unit-tests because they didn't implement the CFRunLoop versions of their method callbacks (you get a runtime crash because of the missing method bodies, with "message sent to unrecognized selector"). I've logged a bug against Amazon S3 too, obviously.

Adam
  • 32,900
  • 16
  • 126
  • 153
  • This is not an Xcode question. Anyway, you can setup it by adding a timer to the main run loop for the default run loop mode, then sending `[[NSRunLoop mainRunLoop] run];` –  Apr 26 '13 at 11:11
  • Actually, it is an xcode question: Xcode's built-in system for running unit-tests is what creates the strange environment (it's not my code, it's not my linker setup, etc) – Adam Apr 26 '13 at 11:58
  • Updated question (more digging, I found some more specifics on what's actually going on / going wrong) – Adam May 01 '13 at 10:31
  • @H2CO3 I've read your comment multiple times, I cannot understand what you're saying. Could you please explain each step? The only bit I understand - telling the main runloop to run - won't change anything on its own. – Adam May 01 '13 at 17:22
  • you have to add a running `NSTimer` to the main run loop using the `addTimer:forMode:` (or whatever that method is called, look it up in the docs). –  May 01 '13 at 17:56

0 Answers0