From 4523e67c995d5596bd5313a7b8f9eb250d6cbb25 Mon Sep 17 00:00:00 2001 From: John Rosendahl Date: Fri, 30 Oct 2026 14:37:11 -0600 Subject: [PATCH] Stop hard-coding an IDFA and a GAID in the Objective-C demo The Objective-C demo sent a fixed IDFA and a fixed Google GAID (an Android ID) with every identify call. Like the Swift demo, ask for App Tracking Transparency permission instead and let the SDK add the real IDFA when the user allows it. Co-Authored-By: Claude Opus 5.5 --- .../demo-ios-objc/IdentifyViewController.m | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/demo-ios-objc/demo-ios-objc/IdentifyViewController.m b/demo-ios-objc/demo-ios-objc/IdentifyViewController.m index ffe8267..bd062e7 100644 --- a/demo-ios-objc/demo-ios-objc/IdentifyViewController.m +++ b/demo-ios-objc/demo-ios-objc/IdentifyViewController.m @@ -11,6 +11,7 @@ #import "AppDelegate.h" #import "demo_ios_objc-Swift.h" +@import AppTrackingTransparency; @import OptableSDK; @interface IdentifyViewController () @@ -51,18 +52,23 @@ - (IBAction)dispatchIdentify:(id)sender { _identifyOutput.text = output; - NSError *error = nil; - - [OPTABLE identify: @[ - [OptableSDKIdentifier identifierWithType:OptableSDKIdentifierType_EmailAddress value:email], - [OptableSDKIdentifier identifierWithType:OptableSDKIdentifierType_PhoneNumber value:@"+1234567890"], - [OptableSDKIdentifier identifierWithType:OptableSDKIdentifierType_AppleIDFA value:@"06DE8C6A-A431-4235-A262-E3A9C2CCEB34"], - [OptableSDKIdentifier identifierWithType:OptableSDKIdentifierType_GoogleGAID value:@"D04BB8C3-5A3E-4964-9757-D38365F59E6A"], - [OptableSDKIdentifier identifierWithRawType:@"c" value:@"new-custom.ABC"], - [OptableSDKIdentifier identifierWithType:OptableSDKIdentifierType_Custom value:@"custom-7" customIdx:@7], - [OptableSDKIdentifier identifierWithString:@"c9:custom-9-id"], - ] - error: &error]; + // If the user gives consent to be tracked - IDFA will be added + // automatically to the list of identifiers, + // either in the `identify` or `targeting` calls + [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) { + dispatch_async(dispatch_get_main_queue(), ^{ + NSError *error = nil; + + [OPTABLE identify: @[ + [OptableSDKIdentifier identifierWithType:OptableSDKIdentifierType_EmailAddress value:email], + [OptableSDKIdentifier identifierWithType:OptableSDKIdentifierType_PhoneNumber value:@"+1234567890"], + [OptableSDKIdentifier identifierWithRawType:@"c" value:@"new-custom.ABC"], + [OptableSDKIdentifier identifierWithType:OptableSDKIdentifierType_Custom value:@"custom-7" customIdx:@7], + [OptableSDKIdentifier identifierWithString:@"c9:custom-9-id"], + ] + error: &error]; + }); + }]; } // MARK: - UITextFieldDelegate