|
31 | 31 | #import "PFObjectState_Private.h" |
32 | 32 | #import "PFObjectConstants.h" |
33 | 33 |
|
| 34 | +// The prefix removed from the CFBundleIdentifier sent with the installation |
| 35 | +// for macOS Catalyst apps for installations; |
| 36 | +static const NSString * kMacCatalystBundleIdPrefix = @"maccatalyst."; |
| 37 | + |
| 38 | + |
34 | 39 | @implementation PFInstallation (Private) |
35 | 40 |
|
36 | 41 | static NSSet *protectedKeys; |
@@ -293,6 +298,22 @@ - (void)_updateVersionInfoFromDevice { |
293 | 298 | NSString *appName = appInfo[(__bridge NSString *)kCFBundleNameKey]; |
294 | 299 | NSString *appVersion = appInfo[(__bridge NSString *)kCFBundleVersionKey]; |
295 | 300 | NSString *appIdentifier = appInfo[(__bridge NSString *)kCFBundleIdentifierKey]; |
| 301 | + |
| 302 | +#ifdef TARGET_OS_MACCATALYST |
| 303 | + // If using an Xcode new enough to know about Mac Catalyst: |
| 304 | + // Mac Catalyst Apps use a prefix to the bundle ID. This should not be transmitted |
| 305 | + // to the parse backend. Catalyst apps should look like iOS apps otherwise |
| 306 | + // push and other services don't work properly. |
| 307 | + if (@available(macCatalyst 13.0, *)) { |
| 308 | + if (appIdentifier) { |
| 309 | + NSRange macCatalystPrefix = [appIdentifier rangeOfString:(NSString *)kMacCatalystBundleIdPrefix]; |
| 310 | + if (macCatalystPrefix.location == 0) { |
| 311 | + appIdentifier = [appIdentifier stringByReplacingCharactersInRange:macCatalystPrefix |
| 312 | + withString:@""]; |
| 313 | + } |
| 314 | + } |
| 315 | + } |
| 316 | +#endif |
296 | 317 | // It's possible that the app was created without an info.plist and we just |
297 | 318 | // cannot get the data we need. |
298 | 319 | // Note: it's important to make the possibly nil string the message receptor for |
|
0 commit comments