Skip to content

Commit f97da7c

Browse files
committed
CORE-1259 add optional macro to exclude idfa code.
1 parent be73cdd commit f97da7c

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

Branch-SDK/BNCSystemObserver.m

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,14 @@ + (NSString *)getUniqueHardwareId:(BOOL *)isReal
4747
}
4848

4949
+ (NSString*) getAdId {
50+
51+
// This macro is unnecessary since this code only runs if AdSupport.framework is included
52+
// However, some clients feel more comfortable with no IDFA code at all.
53+
#ifdef BRANCH_EXCLUDE_IDFA_CODE
54+
return nil;
55+
56+
#else
5057
NSString *uid = nil;
51-
5258
Class ASIdentifierManagerClass = NSClassFromString(@"ASIdentifierManager");
5359
if (ASIdentifierManagerClass) {
5460
SEL sharedManagerSelector = NSSelectorFromString(@"sharedManager");
@@ -65,8 +71,8 @@ + (NSString*) getAdId {
6571
uid = nil;
6672
}
6773
}
68-
6974
return uid;
75+
#endif
7076
}
7177

7278
+ (NSString *)getVendorId {
@@ -75,6 +81,13 @@ + (NSString *)getVendorId {
7581
}
7682

7783
+ (BOOL)adTrackingSafe {
84+
85+
// This macro is unnecessary since this code only runs if AdSupport.framework is included
86+
// However, some clients feel more comfortable with no IDFA code at all.
87+
#ifdef BRANCH_EXCLUDE_IDFA_CODE
88+
return NO;
89+
90+
#else
7891
Class ASIdentifierManagerClass = NSClassFromString(@"ASIdentifierManager");
7992
if (ASIdentifierManagerClass) {
8093
SEL sharedManagerSelector = NSSelectorFromString(@"sharedManager");
@@ -83,7 +96,8 @@ + (BOOL)adTrackingSafe {
8396
BOOL enabled = ((BOOL (*)(id, SEL))[sharedManager methodForSelector:advertisingEnabledSelector])(sharedManager, advertisingEnabledSelector);
8497
return enabled;
8598
}
86-
return YES;
99+
return NO;
100+
#endif
87101
}
88102

89103
+ (NSString *)getDefaultUriScheme {

0 commit comments

Comments
 (0)