Change the Xcode path
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Create a script folder
mkdir scripts
Make a copy of the RunPlatformUnitTests file into your scripts folder
cp /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Tools/RunPlatformUnitTests scripts/
Update line 95 from
Warning ${LINENO} "Skipping tests; the iPhoneSimulator platform does not currently support application-hosted tests (TEST_HOST set)."
to
export OTHER_TEST_FLAGS="-RegisterForSystemEvents" RunTestsForApplication "${TEST_HOST}" "${TEST_BUNDLE_PATH}"
Update the build phase > run script in your test target to
# Run the unit tests in this test bundle. "${SRCROOT}/scripts/RunPlatformUnitTests"
xcodebuild -target MyApp -sdk iphonesimulator5.1 -configuration Debug
xcodebuild -target MyAppTests -sdk iphonesimulator5.1 -configuration Debug TEST_AFTER_BUILD=YES
xcodebuild -workspace MyApp.xcworkspace -scheme SchemeName -sdk $IPHONE_SIM_SDK -configuration Debug clean build
xcodebuild -workspace MyApp.xcworkspace -scheme SchemeTestName -sdk $IPHONE_SIM_SDK -configuration Debug clean build TEST_AFTER_BUILD=YES
xcodebuild -target MyAppTests -sdk iphonesimulator5.1 -configuration Debug TEST_AFTER_BUILD=YES
xcodebuild -target MyApp -sdk iphoneos5.1
[ -d archive ] || mkdir archive
xcrun -sdk iphoneos5.1 PackageApplication -v build/Release-iphoneos/MyApp.app -o archive/MyApp.ipa
xcodebuild -target MyApp -sdk iphonesimulator5.1 clean build
xcodebuild -target MyApp -sdk iphoneos5.1 clean build
lipo -create "path/to/simulator/libary" "path/to/os/library" -output "path/to/universal/library"