Skip to content
Merged
1 change: 1 addition & 0 deletions Parse/Configurations/Parse-macOS.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 21 additions & 0 deletions Parse/Parse/PFInstallation.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions Parse/Tests/Unit/PinningObjectStoreTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ @implementation PinningObjectStoreTests
#pragma mark - Tests
///--------------------------------------

- (void)setUp
{
[PFPin registerSubclass];

[super setUp];
}

- (void)testConstructors {
id dataSource = [self mockedDataSource];

Expand Down