Episode #39

Smart JSON Parsing

18 minutes
Published on October 25, 2012

This video is only available to subscribers. Get access to this video and 584 others.

Parsing JSON responses into Objective-C Objects can be tedious. In this episode, we start development on a smart JSON parsing class that can alleviate some of the mundane work usually required for this functionality.

Episode Links

Running Unit Tests from the Command Line

This is, unfortunately, not properly supported. There are a few hacks to get this to work, including the one mentioned here:

http://www.raingrove.com/2012/03/28/running-ocunit-and-specta-tests-from-command-line.html

The solution recommended here, however, is to modify a system script, which is not something I usually like to do.

Instead here are the steps I followed:

  1. Create a new scheme called RunTests based on your unit test target (or whatever you'd like)
  2. Edit the Scheme and click on the Build action. Make sure that your test has "Run" checked
  3. Remove the Test Host setting from the target's build settings.
  4. (optional) Uncheck "Output Environment Variables" from the Run Script Build Phase for running the tests

Then run this in Terminal:

xcodebuild -workspace MyWorkspace.xcworkspace -sdk iphonesimulator TEST_AFTER_BUILD=YES clean build

If you get an error about "No active architectures", then you can add ACTIVE_ARCH_ONLY=NO.

Once this works, you can use the gist linked above.