Skip to content

Commit 1e63319

Browse files
Update DYLD_FALLBACK_LIBRARY_PATH to the new path (#416)
We found an app launch crash where it complains cannot load image @rpath/libXCTestSwiftSupport.dylib. This dylib is in "platform/Developer/usr/lib" which has an updated path over the years of Xcode evolvement. Updating the `DYLD_FALLBACK_LIBRARY_PATH` to use the new path so the simulator can pick up the dylib. Co-authored-by: Ravi Kumar Mandala <rmandala@linkedin.com>
1 parent db09487 commit 1e63319

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

bp/src/SimulatorHelper.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ + (NSDictionary *)appLaunchEnvironmentWithBundleID:(NSString *)hostBundleID
7373
}
7474
NSMutableDictionary<NSString *, NSString *> *environment = [@{
7575
@"DYLD_FALLBACK_FRAMEWORK_PATH" : [NSString stringWithFormat:@"%@/Library/Frameworks:%@/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks", config.xcodePath, config.xcodePath],
76-
@"DYLD_FALLBACK_LIBRARY_PATH" : [NSString stringWithFormat:@"%@/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib", config.xcodePath],
76+
@"DYLD_FALLBACK_LIBRARY_PATH" : [NSString stringWithFormat:@"%@/Platforms/iPhoneSimulator.platform/Developer/usr/lib", config.xcodePath],
7777
@"DYLD_INSERT_LIBRARIES" : libXCTestBundleInjectValue,
7878
@"DYLD_LIBRARY_PATH" : [NSString stringWithFormat:@"%@/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks", config.xcodePath],
7979
@"DYLD_ROOT_PATH" : [NSString stringWithFormat:@"%@/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot", config.xcodePath],
@@ -155,7 +155,7 @@ + (NSString *)testEnvironmentWithConfiguration:(BPConfiguration *)config {
155155

156156
+ (NSString *)bundleIdForPath:(NSString *)path {
157157
NSDictionary *dic = [NSDictionary dictionaryWithContentsOfFile:[path stringByAppendingPathComponent:@"Info.plist"]];
158-
158+
159159
NSString *platform = [dic objectForKey:@"DTPlatformName"];
160160
if (platform && ![platform isEqualToString:@"iphonesimulator"]) {
161161
[BPUtils printInfo:ERROR withString:@"Wrong platform in %@. Expected 'iphonesimulator', found '%@'", path, platform];

bp/tests/SimulatorHelperTests.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ @implementation SimulatorHelperTests
2020

2121
- (void)setUp {
2222
[super setUp];
23-
23+
2424
[BPUtils quietMode:[BPUtils isBuildScript]];
2525

2626
}
@@ -40,6 +40,7 @@ - (void)testAppLaunchEnvironment {
4040
config.outputDirectory = @"/Users/test/output";
4141
NSDictionary *appLaunchEnvironment = [SimulatorHelper appLaunchEnvironmentWithBundleID:hostBundleId device:nil config:config];
4242
XCTAssert([appLaunchEnvironment[@"DYLD_FALLBACK_FRAMEWORK_PATH"] containsString:@"Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks"]);
43+
XCTAssert([appLaunchEnvironment[@"DYLD_FALLBACK_LIBRARY_PATH"] containsString:@"Platforms/iPhoneSimulator.platform/Developer/usr/lib"]);
4344
XCTAssert([appLaunchEnvironment[@"DYLD_INSERT_LIBRARIES"] containsString:@"libXCTestBundleInject.dylib"]);
4445
XCTAssert([appLaunchEnvironment[@"DYLD_LIBRARY_PATH"] containsString:@"/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks"]);
4546
XCTAssert([appLaunchEnvironment[@"XCTestConfigurationFilePath"] containsString:@"T/BPSampleAppTests-"]);

0 commit comments

Comments
 (0)