Reputation: 3345
I'm trying to add unit tests to an existing universal app in Xcode 4. I've followed the tutorials and while the logic tests run fine in the simulator, when I try to test on device I get a dialog saying "Logic Testing on iOS devices is not supported. You can run logic tests on the Simulator." However, I've noticed that when you create a new project in Xcode 4 and check the Include Unit Tests box, it will actually install and run the tests on device. Am I missing an option somewhere that would allow me enable that on my existing project?
Upvotes: 7
Views: 4475
Reputation: 3345
I think I figured it out by going line by line through the Build Settings for the Cocoa Touch Unit Testing Bundle.
Build Settings
Linker
$(BUILT_PRODUCTS_DIR)/[Your App Name].app/[YourAppName]
Unit Testing
$(BUNDLE_LOADER)
Build Phases
Add the application target to the Target Dependencies.
Once you do all that, you can just hook up your device and hit Test.
Upvotes: 17