diff --git a/Parse/Configurations/Parse-macOS.xcconfig b/Parse/Configurations/Parse-macOS.xcconfig index 893d35113..1f11e5dd1 100644 --- a/Parse/Configurations/Parse-macOS.xcconfig +++ b/Parse/Configurations/Parse-macOS.xcconfig @@ -18,4 +18,5 @@ INFOPLIST_FILE = $(PROJECT_DIR)/Parse/Resources/Parse-OSX.Info.plist // TODO: (nlutsenko) Cleanup source code so we can safely ignore local variable shadow warnings. GCC_WARN_SHADOW = NO +CONFIGURATION_BUILD_DIR=$(BUILD_DIR)/$(CONFIGURATION) FRAMEWORK_SEARCH_PATHS = $(inherited) $(SRCROOT)/../Carthage/Build/Mac diff --git a/Parse/Parse/PFInstallation.m b/Parse/Parse/PFInstallation.m index 25aeb96c0..445f91325 100644 --- a/Parse/Parse/PFInstallation.m +++ b/Parse/Parse/PFInstallation.m @@ -31,6 +31,11 @@ #import "PFObjectState_Private.h" #import "PFObjectConstants.h" +// The prefix removed from the CFBundleIdentifier sent with the installation +// for macOS Catalyst apps for installations; +static const NSString * kMacCatalystBundleIdPrefix = @"maccatalyst."; + + @implementation PFInstallation (Private) static NSSet *protectedKeys; @@ -293,6 +298,22 @@ - (void)_updateVersionInfoFromDevice { NSString *appName = appInfo[(__bridge NSString *)kCFBundleNameKey]; NSString *appVersion = appInfo[(__bridge NSString *)kCFBundleVersionKey]; NSString *appIdentifier = appInfo[(__bridge NSString *)kCFBundleIdentifierKey]; + +#ifdef TARGET_OS_MACCATALYST + // If using an Xcode new enough to know about Mac Catalyst: + // Mac Catalyst Apps use a prefix to the bundle ID. This should not be transmitted + // to the parse backend. Catalyst apps should look like iOS apps otherwise + // push and other services don't work properly. + if (@available(macCatalyst 13.0, *)) { + if (appIdentifier) { + NSRange macCatalystPrefix = [appIdentifier rangeOfString:(NSString *)kMacCatalystBundleIdPrefix]; + if (macCatalystPrefix.location == 0) { + appIdentifier = [appIdentifier stringByReplacingCharactersInRange:macCatalystPrefix + withString:@""]; + } + } + } +#endif // It's possible that the app was created without an info.plist and we just // cannot get the data we need. // Note: it's important to make the possibly nil string the message receptor for diff --git a/Parse/Tests/Unit/PinningObjectStoreTests.m b/Parse/Tests/Unit/PinningObjectStoreTests.m index 064068b7b..524319adb 100644 --- a/Parse/Tests/Unit/PinningObjectStoreTests.m +++ b/Parse/Tests/Unit/PinningObjectStoreTests.m @@ -36,6 +36,13 @@ @implementation PinningObjectStoreTests #pragma mark - Tests ///-------------------------------------- +- (void)setUp +{ + [PFPin registerSubclass]; + + [super setUp]; +} + - (void)testConstructors { id dataSource = [self mockedDataSource];