@@ -65,11 +65,16 @@ + (NSDictionary *)appLaunchEnvironmentWithBundleID:(NSString *)hostBundleID
65
65
NSString *hostAppExecPath = [SimulatorHelper executablePathforPath: config.appBundlePath];
66
66
NSString *hostAppPath = [hostAppExecPath stringByDeletingLastPathComponent ];
67
67
NSString *testSimulatorFrameworkPath = [hostAppPath stringByDeletingLastPathComponent ];
68
- NSString *libXCTestBundleInject = [[hostAppPath stringByAppendingPathComponent: @" Frameworks" ] stringByAppendingPathComponent: @" libXCTestBundleInject.dylib" ];
68
+ NSString *libXCTestBundleInjectPath = [[hostAppPath stringByAppendingPathComponent: @" Frameworks" ] stringByAppendingPathComponent: @" libXCTestBundleInject.dylib" ];
69
+ NSString *libXCTestBundleInjectValue = libXCTestBundleInjectPath;
70
+ if (![NSFileManager .defaultManager fileExistsAtPath: libXCTestBundleInjectPath]) {
71
+ [BPUtils printInfo: DEBUGINFO withString: @" Not injecting libXCTestBundleInject dylib because it was not found in the app host bundle at path: %@ " , libXCTestBundleInjectValue];
72
+ libXCTestBundleInjectValue = @" " ;
73
+ }
69
74
NSMutableDictionary <NSString *, NSString *> *environment = [@{
70
75
@" DYLD_FALLBACK_FRAMEWORK_PATH" : [NSString stringWithFormat: @" %@ /Library/Frameworks:%@ /Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks" , config.xcodePath, config.xcodePath],
71
76
@" DYLD_FALLBACK_LIBRARY_PATH" : [NSString stringWithFormat: @" %@ /Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib" , config.xcodePath],
72
- @" DYLD_INSERT_LIBRARIES" : libXCTestBundleInject ,
77
+ @" DYLD_INSERT_LIBRARIES" : libXCTestBundleInjectValue ,
73
78
@" DYLD_LIBRARY_PATH" : [NSString stringWithFormat: @" %@ /Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks" , config.xcodePath],
74
79
@" DYLD_ROOT_PATH" : [NSString stringWithFormat: @" %@ /Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot" , config.xcodePath],
75
80
@" NSUnbufferedIO" : @" 1" ,
0 commit comments