浏览代码

try to fix issue with xcode 8 tests on travis caused by xcpretty

Fabian Ehrentraud 8 年之前
父节点
当前提交
1c150861af
共有 1 个文件被更改,包括 10 次插入2 次删除
  1. 10 2
      Tests/MasonryTestsLoader/CASAppDelegate.m

+ 10 - 2
Tests/MasonryTestsLoader/CASAppDelegate.m

@@ -11,8 +11,16 @@
 @implementation CASAppDelegate
 
 + (void)initialize {
-    [[NSUserDefaults standardUserDefaults] setValue:@"XCTestLog,GcovTestObserver"
-                                             forKey:@"XCTestObserverClass"];
+	// https://github.com/fastlane/fastlane/issues/3886#issuecomment-224884332
+	// XCode 7.3 introduced a bug where early registration of a test observer prevented
+	// default XCTest test observer from being registered. That caused no logs being printed
+	// onto console, which in result broke several tools that relied on this.
+	// In order to go around the issue we're deferring registration to allow default
+	// test observer to register first.
+	dispatch_async(dispatch_get_main_queue(), ^{
+		[[NSUserDefaults standardUserDefaults] setValue:@"XCTestLog,GcovTestObserver"
+												 forKey:@"XCTestObserverClass"];
+	});
 }
 
 - (void)applicationWillTerminate:(UIApplication *)application {