From c8a260358541a58c7578ad24f4ae0bfef3a51cae Mon Sep 17 00:00:00 2001 From: mmark Date: Wed, 7 Oct 2020 12:56:56 -0700 Subject: [PATCH] only reference libXCTestBundleInject.dylib if it exists --- bp/src/SimulatorHelper.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bp/src/SimulatorHelper.m b/bp/src/SimulatorHelper.m index 92d056a1..9369749b 100644 --- a/bp/src/SimulatorHelper.m +++ b/bp/src/SimulatorHelper.m @@ -65,11 +65,12 @@ + (NSDictionary *)appLaunchEnvironmentWithBundleID:(NSString *)hostBundleID NSString *hostAppExecPath = [SimulatorHelper executablePathforPath:config.appBundlePath]; NSString *hostAppPath = [hostAppExecPath stringByDeletingLastPathComponent]; NSString *testSimulatorFrameworkPath = [hostAppPath stringByDeletingLastPathComponent]; - NSString *libXCTestBundleInject = [[hostAppPath stringByAppendingPathComponent:@"Frameworks"] stringByAppendingPathComponent:@"libXCTestBundleInject.dylib"]; + NSString *libXCTestBundleInjectPath = [[hostAppPath stringByAppendingPathComponent:@"Frameworks"] stringByAppendingPathComponent:@"libXCTestBundleInject.dylib"]; + NSString *libXCTestBundleInjectValue = [NSFileManager.defaultManager fileExistsAtPath:libXCTestBundleInjectPath] ? libXCTestBundleInjectPath : @""; NSMutableDictionary *environment = [@{ @"DYLD_FALLBACK_FRAMEWORK_PATH" : [NSString stringWithFormat:@"%@/Library/Frameworks:%@/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks", config.xcodePath, config.xcodePath], @"DYLD_FALLBACK_LIBRARY_PATH" : [NSString stringWithFormat:@"%@/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib", config.xcodePath], - @"DYLD_INSERT_LIBRARIES" : libXCTestBundleInject, + @"DYLD_INSERT_LIBRARIES" : libXCTestBundleInjectValue, @"DYLD_LIBRARY_PATH" : [NSString stringWithFormat:@"%@/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks", config.xcodePath], @"DYLD_ROOT_PATH" : [NSString stringWithFormat:@"%@/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot", config.xcodePath], @"NSUnbufferedIO" : @"1",