diff --git a/Shims/Binaries/libMaculator.dylib b/Shims/Binaries/libMaculator.dylib index b11c8026..ceb6d91f 100755 Binary files a/Shims/Binaries/libMaculator.dylib and b/Shims/Binaries/libMaculator.dylib differ diff --git a/Shims/Binaries/libShimulator.dylib b/Shims/Binaries/libShimulator.dylib index 1c031577..de531b7b 100755 Binary files a/Shims/Binaries/libShimulator.dylib and b/Shims/Binaries/libShimulator.dylib differ diff --git a/Shims/Shimulator/TestLoadingShim/FBXCTestMain.m b/Shims/Shimulator/TestLoadingShim/FBXCTestMain.m index 1ec907cd..49db47b7 100644 --- a/Shims/Shimulator/TestLoadingShim/FBXCTestMain.m +++ b/Shims/Shimulator/TestLoadingShim/FBXCTestMain.m @@ -16,6 +16,14 @@ #import "XCTestPrivate.h" #import "FBDebugLog.h" +#include "TargetConditionals.h" + +#if TARGET_IPHONE_SIMULATOR +#import +#elif TARGET_OS_MAC +#import +#endif + static NSString *const ShimulatorStartXCTest = @"SHIMULATOR_START_XCTEST"; __attribute__((constructor)) static void XCTestMainEntryPoint() @@ -54,6 +62,21 @@ BOOL FBLoadXCTestIfNeeded() return YES; } +void FBDeployBlockWhenAppLoads(void(^mainBlock)()) { +#if TARGET_IPHONE_SIMULATOR + NSString *notification = UIApplicationDidFinishLaunchingNotification; +#elif TARGET_OS_MAC + NSString *notification = NSApplicationDidFinishLaunchingNotification; +#endif + [[NSNotificationCenter defaultCenter] + addObserverForName:notification + object:nil + queue:[NSOperationQueue mainQueue] + usingBlock:^(NSNotification *note) { + mainBlock(); + }]; +} + BOOL FBXCTestMain() { if (!FBLoadXCTestIfNeeded()) { @@ -98,10 +121,11 @@ BOOL FBXCTestMain() NSLog(@"Failed load test bundle with error: %@", error); return NO; } - void (*XCTestMain)(XCTestConfiguration *) = (void (*)(XCTestConfiguration *))FBRetrieveXCTestSymbol("_XCTestMain"); - CFRunLoopPerformBlock([NSRunLoop mainRunLoop].getCFRunLoop, kCFRunLoopCommonModes, ^{ - XCTestMain(configuration); + FBDeployBlockWhenAppLoads(^{ + CFRunLoopPerformBlock([NSRunLoop mainRunLoop].getCFRunLoop, kCFRunLoopCommonModes, ^{ + XCTestMain(configuration); + }); }); return YES; }