Created
July 18, 2014 06:08
-
-
Save SiarheiFedartsou/97457b95413ced000193 to your computer and use it in GitHub Desktop.
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
#ifdef DEBUG | |
/// Tests if .xctest bundle is loaded, so returns YES if the app is running with XCTest framework. | |
inline BOOL IsUnitTesting() __attribute__((const)); | |
inline BOOL IsUnitTesting() | |
{ | |
NSDictionary *environment = [NSProcessInfo processInfo].environment; | |
NSString *injectBundlePath = environment[@"XCInjectBundle"]; | |
return [injectBundlePath.pathExtension isEqualToString:@"xctest"]; | |
} | |
#endif | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
#ifdef DEBUG | |
if (IsUnitTesting()) return YES; | |
#endif | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment