Proper Xcode 5 support

`TEST_AFTER_BUILD` doesn't do anything on Xcode 5. Instead, try the `test` action, falling back to `build` if that fails.

Also:

 * Implemented automatic fallbacks for iOS builds, so hopefully `-sdk iphonesimulator` will get automatically added in most cases. _(This was the number one reason to use a custom `cibuild` script before.)_
 * Stopped recursively invoking the script. It's too confusing, so I just factored things out into a function instead.
 * Stopped `cd`ing out of the working directory. This could result in a broken `SCRIPT_DIR` if the project file is actually located elsewhere, like in [ReactiveCocoa](https://github.com/ReactiveCocoa/ReactiveCocoa/tree/master/ReactiveCocoaFramework).