title: How do I create application tests in a Cocoa Touch Unit Testing Bundle with Xcode 4?
body: <p>I've created an Xcode 4 project with a Cocoa Touch Unit Testing Bundle. I'm able to create and run logic tests successfully. However, I'm not sure how to create a test as an application test that runs on an iOS device and uses UIKit. When I create a test that uses UIKit and try to run the tests in the bundle on the device, Xcode 4 pops up a dialog saying:</p>
  
  <blockquote>
    <p><strong>Logic Testing Unavailable</strong></p>
    
    <p>Logic Testing on iOS devices is not supported. You can run logic tests on the Simulator.</p>
  </blockquote>
  
  <p>I tried running the test on the simulator, but of course it failed when making UIKit calls.</p>
  
  <p>Does anyone know how to create and run application tests on iOS devices using Xcode 4 and a Cocoa Touch Unit Testing Bundle?</p>
  
  <p><strong>EDIT:</strong> In case it helps, here is the test code:</p>
  
  <pre><code>@implementation TinyWordsTests
  
  - (void)setUp
  {
      [super setUp];
      CC_DIRECTOR_INIT();
  }
  
  - (void)tearDown
  {
      CC_DIRECTOR_END();
      [super tearDown];
  }
  
  - (void)testExample
  {
      CCScene *scene = [TWOHelloWorldLayer scene];
      STAssertNotNil(scene, @"Scene must not be nil.");
  }
  
  @end
  </code></pre>
  
  <p>and the resulting stack trace from gdb when the test is run in the simulator:</p>
  
  <pre><code>(gdb) bt
  #0  0x00464781 in __HALT ()
  #1  0x003af8ed in _CFRuntimeCreateInstance ()
  #2  0x00da81ea in GSFontCreateWithName ()
  #3  0x038f55eb in UINewFont ()
  #4  0x038f56bd in +[UIFont fontWithName:size:traits:] ()
  #5  0x038f507d in +[UIFont fontWithName:size:] ()
  #6  0x01a49205 in -[CCTexture2D(Text) initWithString:fontName:fontSize:] (self=0x197f9f0, _cmd=0xe10840, string=0x1a9c900, name=0x1a9c8f0, size=64) at CCTexture2D.m:487
  #7  0x01a2d897 in -[CCLabelTTF setString:] (self=0x1981d70, _cmd=0x156e07, str=0x1a9c900) at CCLabelTTF.m:95
  #8  0x01a2dc9d in -[CCLabelTTF initWithString:fontName:fontSize:] (self=0x1981d70, _cmd=0xe10840, str=0x1a9c900, name=0x1a9c8f0, size=64) at CCLabelTTF.m:79
  #9  0x01a2da9a in +[CCLabelTTF labelWithString:fontName:fontSize:] (self=0x1a9b53c, _cmd=0xe0ddc0, string=0x1a9c900, name=0x1a9c8f0, size=64) at CCLabelTTF.m:53
  #10 0x01a01b10 in -[TWOHelloWorldLayer init] (self=0x197ee40, _cmd=0x2c7c) at TWOHelloWorldLayer.m:39
  #11 0x01a341bb in +[CCNode node] (self=0x1a99ee4, _cmd=0x3baad59) at CCNode.m:231
  #12 0x01a01a80 in +[TWOHelloWorldLayer scene] (self=0x1a99ee4, _cmd=0xe00fa0) at TWOHelloWorldLayer.m:22
  #13 0x01a5d430 in -[TinyWordsTests testExample] (self=0x197e490, _cmd=0xe59dd0) at TinyWordsTests.m:30
  #14 0x00410c7d in __invoking___ ()
  #15 0x00410b51 in -[NSInvocation invoke] ()
  #16 0x201043d2 in -[SenTestCase invokeTest] ()
  #17 0x20104aa7 in -[SenTestCase performTest:] ()
  #18 0x201041d3 in -[SenTest run] ()
  #19 0x20106eda in -[SenTestSuite performTest:] ()
  #20 0x201041d3 in -[SenTest run] ()
  #21 0x20106eda in -[SenTestSuite performTest:] ()
  #22 0x201041d3 in -[SenTest run] ()
  #23 0x201067a4 in +[SenTestProbe runTests:] ()
  #24 0x000023c7 in ?? ()
  #25 0x000025f2 in ?? ()
  #26 0x0000209a in ?? ()
  #27 0x00002049 in ?? ()
  </code></pre>