Created
July 3, 2014 00:54
-
-
Save kzim44/7a7aac6b8a9485c3091e to your computer and use it in GitHub Desktop.
Alternate AppDelegate for XCTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//I had a need to use a different app delegate in Convene’s XCTest suite today, so I took the time to figure out how to do it. Quite simple really: | |
//Switch your main.m to: | |
@autoreleasepool { | |
BOOL runningTests = NSClassFromString(@"XCTestCase") != nil; | |
if (!runningTests) { | |
return UIApplicationMain(argc, argv, nil, NSStringFromClass([CVNAppDelegate class])); | |
} else { | |
return UIApplicationMain(argc, argv, nil, @"CVNTestAppDelegate"); | |
} | |
} | |
/* | |
Add your test app delegate to your test target looking like: | |
CVNTestAppDelegate.h | |
@interface CVNTestAppDelegate : NSObject<UIApplicationDelegate> | |
@end | |
CVNTestAppDelegate.m | |
#import "CVNTestAppDelegate.h" | |
@implementation CVNTestAppDelegate | |
@end | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment