Skip to content

Commit

Permalink
Update domain configuration messages
Browse files Browse the repository at this point in the history
Summary: Update domain configuration messages.

Reviewed By: ryantobinmeta

Differential Revision: D55404843

fbshipit-source-id: 85673604f7468d1e25e93a87c4c82c283b02e529
  • Loading branch information
jjiang10 authored and facebook-github-bot committed Mar 27, 2024
1 parent aeffd94 commit 14073f4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions FBSDKCoreKit/FBSDKCoreKit/FBSDKInternalUtility.m
Expand Up @@ -491,7 +491,7 @@ - (void)validateFacebookReservedURLSchemes

- (void)detectFatalTrackingDomainsConfig
{
if (!self.settings.isDomainErrorEnabled || ![FBSDKAppEventsUtility.shared isDebugBuild]) {
if (![FBSDKAppEventsUtility.shared isDebugBuild]) {
return;
}

Expand All @@ -506,16 +506,19 @@ - (void)detectFatalTrackingDomainsConfig
@"Facebook_FacebookCore.bundle",
@"Facebook_FacebookLogin.bundle",
@"Facebook_FacebookShare.bundle"];
NSString *message = @"We have pre-populated the tracking domain field for the FBSDK in the Privacy Manifest to help ensure that our services continue to function properly. We do not advise manually adding domains. Listing \"www.facebook.com\" or subdomains of \"facebook.com\" in the tracking domain field of a Privacy Manifest may break functionality.";
for (NSString *subdirectory in subdirectories) {
NSString *subdir = [subdirectory isKindOfClass:[NSNull class]] ? nil: subdirectory;
NSArray<NSURL *> *privacyInfoUrls = [[NSBundle mainBundle] URLsForResourcesWithExtension:@"xcprivacy" subdirectory:subdir];
for (NSURL *privacyInfoUrl in privacyInfoUrls) {
NSDictionary *privacyInfo = [[NSDictionary alloc] initWithContentsOfURL:privacyInfoUrl];
NSArray *trackingDomains = privacyInfo[@"NSPrivacyTrackingDomains"];
for (NSString *domain in trackingDomains) {
if ([@"facebook.com" isEqualToString:domain] || [@"ep2.facebook.com" isEqualToString:domain]) {
NSString *reason = [NSString stringWithFormat:@"Configuring facebook.com or ep2.facebook.com as tracking domain could block the connection. Please ensure tracking domains are configured correctly in Privacy Manifest files."];
@throw [NSException exceptionWithName:@"InvalidOperationException" reason:reason userInfo:nil];
if (self.settings.isDomainErrorEnabled && ([@"facebook.com" isEqualToString:domain] || [@"ep2.facebook.com" isEqualToString:domain])) {
NSString *errorMsg = [NSString stringWithFormat:@"%@%@", message, @" Developers can set \"Settings.shared.isDomainErrorEnabled\" to \"false\" in order to disable FBSDK Privacy Manifest related errors."];
@throw [NSException exceptionWithName:@"InvalidOperationException" reason:errorMsg userInfo:nil];
} else if ([@"www.facebook.com" isEqualToString:domain]) {
NSLog(@"%@%@", @"<Warning>: ", message);
}
}
}
Expand Down

0 comments on commit 14073f4

Please sign in to comment.