Improve SDK detection edge cases; utilize iOS 8 dynamic library support.

 - In some cases, a proper SDK might not be set in the build settings. Fall back to a sane default.
 - With iOS 8, clang-as-ios-dylib is no longer needed for dynamic libraries. When using Xcode 6, use the correct base SDK (iphonesimulator) instead of clang-as-ios-dylib. For executables, make a dylib but override the object type to MH_EXECUTE.