Skip to content

Instantly share code, notes, and snippets.

@benasher44
Created March 23, 2016 20:19
Show Gist options
  • Save benasher44/e77248d0e4a45c13d9b5 to your computer and use it in GitHub Desktop.
Save benasher44/e77248d0e4a45c13d9b5 to your computer and use it in GitHub Desktop.
Proposed fix for XCTest-KIF class loading issues
diff --git a/Classes/KIFAccessibilityEnabler.m b/Classes/KIFAccessibilityEnabler.m
index afac189..a501c5b 100644
--- a/Classes/KIFAccessibilityEnabler.m
+++ b/Classes/KIFAccessibilityEnabler.m
@@ -41,12 +41,7 @@
+ (void)load
{
@autoreleasepool {
- if ([XCTestObservationCenter respondsToSelector:@selector(sharedTestObservationCenter)]) {
- XCTestObservationCenter *observationCenter = [XCTestObservationCenter sharedTestObservationCenter];
- [observationCenter addTestObserver:[self sharedAccessibilityEnabler]];
- } else {
- [[self sharedAccessibilityEnabler] _enableAccessibility];
- }
+ [[KIFAccessibilityEnabler sharedAccessibilityEnabler] _enableAccessibility];
}
}
diff --git a/Classes/KIFTestActor.m b/Classes/KIFTestActor.m
index a6babc7..875528c 100644
--- a/Classes/KIFTestActor.m
+++ b/Classes/KIFTestActor.m
@@ -18,14 +18,6 @@
@implementation KIFTestActor
-+ (void)load
-{
- @autoreleasepool {
- NSLog(@"KIFTester loaded");
- [UIApplication swizzleRunLoop];
- }
-}
-
- (instancetype)initWithFile:(NSString *)file line:(NSInteger)line delegate:(id<KIFTestActorDelegate>)delegate
{
self = [super init];
@@ -188,3 +180,19 @@ static NSTimeInterval KIFTestStepDelay = 0.1;
}
@end
+
+@interface UIApplication (KIFTestActorLoading)
+
+@end
+
+@implementation UIApplication (KIFTestActorLoading)
+
++ (void)load
+{
+ @autoreleasepool {
+ NSLog(@"KIFTester loaded");
+ [UIApplication swizzleRunLoop];
+ }
+}
+
+@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment