Skip to content

Commit 54bc6f3

Browse files
fix: MacOS command line app crashes if Parse framework is installed in /Library/Frameworks/ (#1395)
1 parent c4a71e2 commit 54bc6f3

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Parse/Parse/Internal/Object/Subclassing/PFObjectSubclassingController.m

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,21 @@ - (void)_registerSubclassesInLoadedBundle:(NSBundle *)bundle {
336336
return;
337337
}
338338
// Filter out any system bundles
339-
if ([bundle.bundlePath hasPrefix:@"/System/"] || [bundle.bundlePath hasPrefix:@"/Library/"] || [bundle.bundlePath rangeOfString:@"iPhoneSimulator.sdk"].location != NSNotFound) {
339+
if ([bundle.bundlePath hasPrefix:@"/System/"] || [bundle.bundlePath rangeOfString:@"iPhoneSimulator.sdk"].location != NSNotFound) {
340340
return;
341341
}
342+
343+
// The Parse framework cannot be bundled with a macOS Command Line Application but needs to be
344+
// external to the application. The preferred file system location is '/Library/Frameworks'
345+
// and we don't want to filter out the Parse framework if it is installed there. See also:
346+
// https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/InstallingFrameworks.html#//apple_ref/doc/uid/20002261-97286
347+
if ([bundle.bundlePath hasPrefix:@"/Library/"]) {
348+
if ([bundle.bundlePath hasPrefix:@"/Library/Frameworks/"] && [[bundle.bundlePath lastPathComponent] isEqualToString:@"Parse.framework"]) {
349+
[self _registerSubclassesInBundle:bundle];
350+
}
351+
return;
352+
}
353+
342354
[self _registerSubclassesInBundle:bundle];
343355
}
344356

0 commit comments

Comments
 (0)