iOS SDK - 구성 메서드 레퍼런스

iOS SDK - 구성 메서드 레퍼런스

이 문서는 iOS 애플리케이션용 Singular SDK에서 사용할 수 있는 모든 구성 옵션에 대한 종합적인 레퍼런스를 제공합니다. SingularConfig 객체를 사용하면 트래킹 설정, 어트리뷰션 옵션, 프라이버시 컨트롤 등을 포함하여 SDK의 동작을 사용자 정의할 수 있습니다. 각 구성 속성은 설명, 시그니처, 실제 사용 예시와 함께 제시됩니다.

appGroupName

SingularConfig.appGroupName 속성

메인 앱과 앱 익스텐션 간에 데이터를 공유하기 위한 앱 그룹 이름을 설정합니다. SDK에서 앱 익스텐션을 사용할 때 필요합니다.

시그니처

@property (strong) NSString *appGroupName;

사용 예시

Swift Objective-C
// Set app group name for app extensions
config.appGroupName = "group.com.yourcompany.yourapp"

brandedDomains

SingularConfig.brandedDomains 속성

웹-투-앱 어트리뷰션을 위한 브랜디드 도메인을 설정합니다. 이를 통해 어트리뷰션 목적으로 트래킹해야 하는 사용자 정의 도메인을 지정할 수 있습니다.

이 속성을 설정하면 이전에 설정된 모든 브랜디드 도메인이 대체됩니다. 추가하는 방식이 아닌 Singular 할당으로 전체 목록을 전달하십시오.

시그니처

@property (strong) NSArray *brandedDomains;

사용 예시

Swift Objective-C
// Set branded domains for web-to-app attribution
config.brandedDomains = ["yourcompany.com", "go.yourcompany.com"]

clipboardAttribution

엔터프라이즈 기능: 클립보드 기반 DDL은 엔터프라이즈 기능인 Singular WebSDK가 필요합니다. 계정에서 이 기능을 활성화하려면 Customer Success Manager에게 문의하십시오.

SingularConfig.clipboardAttribution 속성

SDK의 클립보드 어트리뷰션을 활성화합니다. 활성화하면 SDK는 초기화 중에 디바이스 클립보드에서 어트리뷰션 링크를 확인합니다. 기본값은 NO 입니다.

시그니처

@property (assign) BOOL clipboardAttribution;

사용 예시

Swift Objective-C
// Enable clipboard attribution
config.clipboardAttribution = true

conversionValueUpdatedCallback

SingularConfig.conversionValueUpdatedCallback 속성

SKAdNetwork 컨버전 값이 업데이트될 때 호출되는 콜백 함수를 설정합니다. 이를 통해 컨버전 값 변경에 반응할 수 있습니다.

시그니처

@property (copy) void(^conversionValueUpdatedCallback)(NSInteger);

사용 예시

Swift Objective-C
// Set conversion value updated callback
config.conversionValueUpdatedCallback = { conversionValue in
    print("Conversion value updated to: \(conversionValue)")
    // Update UI or take other actions based on the new conversion value
}

conversionValuesUpdatedCallback

SingularConfig.conversionValuesUpdatedCallback 속성

SKAdNetwork 4.0 컨버전 값이 업데이트될 때 호출되는 콜백 함수를 설정합니다. 이는 iOS 16.1 이상에 특화되어 있으며, fine, coarse, lock 값의 변경에 반응할 수 있도록 합니다.

시그니처

@property (copy) void(^conversionValuesUpdatedCallback)(NSNumber *, NSNumber *, BOOL);

사용 예시

Swift Objective-C
// Set conversion values updated callback for SKAdNetwork 4.0
config.conversionValuesUpdatedCallback = { fineValue, coarseValue, lock in
    print("Conversion values updated - Fine: \(fineValue ?? 0), Coarse: \(coarseValue ?? 0), Lock: \(lock)")
    // Update UI or take other actions based on the new conversion values
}

customSdid

SingularConfig.customSdid 속성

사용자 정의 SDID(Singular Device ID)를 설정합니다. 이를 통해 Singular가 생성한 식별자를 사용하는 대신 자체 디바이스 식별자를 제공할 수 있습니다.

시그니처

@property (strong) NSString *customSdid;

사용 예시

Swift Objective-C
// Set custom SDID
config.customSdid = "custom-device-id-12345"

deviceAttributionCallback

SingularConfig.deviceAttributionCallback 속성

BETA 기능: 디바이스 어트리뷰션 데이터가 /start 응답에서 사용 가능할 때 호출되는 콜백 함수를 설정합니다. 콜백은 백그라운드 큐에서 디스패치되므로, UI 작업은 메인 스레드로 디스패치하십시오.

값이 있는 필드만 포함되므로 값을 읽기 전에 키의 존재 여부를 확인하세요. 대부분의 설치에서는 일부 필드만 반환되며, 어떤 필드가 포함되는지는 Singular이 매칭한 터치포인트에 따라 달라집니다.

유형 참고
network NSString 콜백이 호출될 때 항상 포함됩니다. 터치포인트가 매칭되지 않은 경우 "Organic"입니다.
campaign_id NSString 터치포인트가 제공하는 경우 포함됩니다.
campaign_name NSString 터치포인트가 제공하는 경우 포함됩니다.
subcampaign_id NSString 터치포인트가 제공하는 경우 포함됩니다. 모든 소스에서 제공되지는 않습니다.
subcampaign_name NSString 터치포인트가 제공하는 경우 포함됩니다. 모든 소스에서 제공되지는 않습니다.
creative_id NSString 터치포인트가 제공하는 경우 포함됩니다. 모든 소스에서 제공되지는 않습니다.
creative_name NSString 터치포인트가 제공하는 경우 포함됩니다. 모든 소스에서 제공되지는 않습니다.
passthrough NSString 링크에 패스스루 값이 첨부된 경우 포함됩니다.
match_type NSString 터치포인트가 제공하는 경우 포함됩니다. 값 목록이 필요하면 Singular에 문의하세요.
click_timestamp NSNumber 터치포인트가 제공하는 경우 포함됩니다. epoch 마이크로초이며, 초 단위로 변환하려면 1,000,000으로 나누세요.

콜백은 /start 응답에 attribution_info 객체가 포함되어 있을 때만 호출됩니다. 자연량 설치의 경우 network 만 채워집니다.

시그니처

@property (copy) void(^deviceAttributionCallback)(NSDictionary *);

사용 예시

Swift Objective-C
// Set device attribution callback
config.deviceAttributionCallback = { attributionData in
    guard let attributionData = attributionData else { return }
    print("Attribution data received: \(attributionData)")

    let network = attributionData["network"] as? String
    let campaignId = attributionData["campaign_id"] as? String
    let campaignName = attributionData["campaign_name"] as? String
    let clickTimestamp = attributionData["click_timestamp"] as? NSNumber

    // UI work must be dispatched to the main thread
    DispatchQueue.main.async {
        if let campaignName = campaignName {
            self.showCampaignSpecificContent(campaignName)
        }
    }
}

didSetSdidHandler

SingularConfig.didSetSdidHandler 속성

customSdid를 통해 SDID(Singular Device ID)를 할당한 후 SDID가 설정될 때 호출되는 콜백 함수를 설정합니다. result 인자는 방금 저장된 SDID 문자열입니다.

일반적으로 sdidReceivedHandler와 함께 사용됩니다. 사용자 정의 SDID를 관리할 때 두 핸들러를 모두 설정하면 SDK가 새 SDID를 수락할 때와 기존 SDID를 표시할 때 모두 알림을 받을 수 있습니다.

시그니처

typedef void (^SdidAccessorHandler)(NSString *result);
@property (copy) SdidAccessorHandler didSetSdidHandler;

사용 예시

Swift Objective-C
// Set callback for when SDID is set
config.customSdid = "custom-device-id-12345"
config.didSetSdidHandler = { sdid in
    print("SDID was set: \(sdid)")
    // Perform any actions needed after SDID is set
}

enableLogging

SingularConfig.enableLogging 속성

SDK 로깅을 활성화합니다. 개발 중 디버깅 및 문제 해결에 유용합니다. 프로덕션 빌드에서는 로깅을 비활성화하는 것이 권장됩니다. 기본값은 NO 입니다.

enableLoggingYES로 설정되고 logLevelSingularLogLevelNone 이상의 값으로 설정될 때까지 로깅은 출력되지 않습니다.

시그니처

@property (assign) BOOL enableLogging;

사용 예시

Swift Objective-C
// Enable logging for debug builds
config.enableLogging = true
config.logLevel = .debug

enableOdmWithTimeoutInterval

SingularConfig.enableOdmWithTimeoutInterval 속성

Google ODM(On-Device Measurement) 조회의 타임아웃 간격을 초 단위로 설정합니다. ODM은 Google의 모바일 광고 측정 시스템으로, 디바이스에서 설치 어트리뷰션 데이터를 표시합니다. 기본값은 0 (ODM 조회 비활성화)입니다.

시그니처

@property (assign) NSInteger enableOdmWithTimeoutInterval;

사용 예시

Swift Objective-C
// Enable Google ODM with 5 second timeout
config.enableOdmWithTimeoutInterval = 5

espDomains

SingularConfig.espDomains 속성

이메일 어트리뷰션을 위한 ESP(Email Service Provider) 도메인을 설정합니다. 이를 통해 어트리뷰션에 고려될 이메일 도메인을 지정할 수 있습니다.

시그니처

@property (strong) NSArray *espDomains;

사용 예시

Swift Objective-C
// Set ESP domains for email attribution
config.espDomains = ["mailchimp.com", "sendgrid.net", "campaign-monitor.com"]

globalProperties

SingularConfig.globalProperties 속성

글로벌 속성 딕셔너리에 대한 읽기 전용 액세스를 제공합니다. 여기에는 구성에 설정된 모든 글로벌 속성이 포함됩니다.

시그니처

@property (readonly) NSMutableDictionary *globalProperties;

사용 예시

Swift Objective-C
// Access global properties
print("Global properties: \(config.globalProperties)")

initWithApiKey

SingularConfig 초기화

API 키와 시크릿으로 새로운 SingularConfig 객체를 초기화합니다. 이는 Singular SDK 구성의 첫 번째 단계입니다.

시그니처

- (id)initWithApiKey:(NSString *)apikey andSecret:(NSString *)secret;

사용 예시

Swift Objective-C
// Create configuration object
let config = SingularConfig(apiKey: "SDK KEY", andSecret: "YOUR_SECRET")

launchOptions

SingularConfig.launchOptions 속성

앱 델리게이트의 launch options 딕셔너리를 설정합니다. 이는 딥링크 및 기타 시작 데이터를 처리하는 데 사용됩니다.

시그니처

@property (strong) NSDictionary *launchOptions;

사용 예시

Swift Objective-C
// Set launch options from app delegate
func application(_ application: UIApplication,
                 didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    let config = SingularConfig(apiKey: "API_KEY", andSecret: "SECRET")
    config.launchOptions = launchOptions
    Singular.start(config)
    return true
}

limitAdvertisingIdentifiers

SingularConfig.limitAdvertisingIdentifiers 속성

광고 식별자의 사용을 활성화하거나 비활성화합니다. 이 옵션은 SDK가 트래킹 및 어트리뷰션을 위해 디바이스 식별자를 수집하고 사용하는 방식에 영향을 미칩니다. 기본값은 NO 입니다.

이 속성은 Singular Kids SDK 빌드에서 컴파일에서 제외됩니다( #ifndef SINGULAR_KIDS로 보호). Singular-Kids-SDK를 연동하는 경우 이 속성은 사용할 수 없습니다. Kids SDK는 더 엄격한 식별자 처리를 자동으로 적용합니다.

시그니처

@property (assign) BOOL limitAdvertisingIdentifiers;

사용 예시

Swift Objective-C
// Enable limited identifiers mode
config.limitAdvertisingIdentifiers = true

logLevel

SingularConfig.logLevel 속성

SDK 로깅의 상세도를 설정합니다. 출력이 발생하려면 enableLogging 을 통해서도 로깅이 활성화되어야 합니다. 기본값은 SingularLogLevelNone (로깅 없음)입니다.

사용 가능한 레벨( SingularLogLevel.h에서):

  • SingularLogLevelNone (0) — 로깅 없음
  • SingularLogLevelError (1) — 오류만
  • SingularLogLevelWarning (2) — 오류 및 중요
  • SingularLogLevelInfo (3) — 오류, 중요 및 정보
  • SingularLogLevelDebug (4) — 디버그를 포함한 모든 로그
  • SingularLogLevelVerbose (5) — 가장 상세함

시그니처

@property (assign) SingularLogLevel logLevel;

사용 예시

Swift Objective-C
// Set verbose logging for detailed debugging
config.enableLogging = true
config.logLevel = .verbose

manualSkanConversionManagement

SingularConfig.manualSkanConversionManagement 속성

SKAdNetwork 컨버전 값의 수동 관리를 활성화합니다. 활성화하면 SDK는 컨버전 값을 자동으로 업데이트하지 않으며, 수동으로 제어할 수 있습니다.

시그니처

@property (assign) BOOL manualSkanConversionManagement;

사용 예시

Swift Objective-C
// Enable manual SKAdNetwork conversion management
config.manualSkanConversionManagement = true

openUrl

SingularConfig.openUrl 속성

앱을 여는 데 사용되는 URL을 설정합니다. 사용자 정의 URL 스킴 딥링크에 사용됩니다.

시그니처

@property (strong) NSURL *openUrl;

사용 예시

Swift Objective-C
// Set open URL for custom URL schemes
func application(_ app: UIApplication,
                 open url: URL,
                 options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
    let config = SingularConfig(apiKey: "API_KEY", andSecret: "SECRET")
    config.openUrl = url
    Singular.start(config)
    return true
}

pushNotificationLinkPath

SingularConfig.pushNotificationLinkPath 속성

푸시 알림 페이로드에서 딥링크를 찾을 경로를 설정합니다. 이를 통해 SDK가 푸시 알림에서 어트리뷰션 링크를 찾아 처리할 수 있도록 도와줍니다.

시그니처

@property (strong) NSArray<NSArray<NSString*>*> *pushNotificationLinkPath;

사용 예시

Swift Objective-C
// Set push notification link paths
config.pushNotificationLinkPath = [
    ["data", "deeplink"],
    ["notification", "data", "url"],
    ["custom", "link"]
]

pushNotificationPayload

SingularConfig.pushNotificationPayload 속성

어트리뷰션을 위한 푸시 알림 페이로드를 설정합니다. 이를 통해 SDK는 초기화 중에 푸시 알림 데이터를 처리할 수 있습니다.

시그니처

@property (strong) NSDictionary *pushNotificationPayload;

사용 예시

Swift Objective-C
// Set push notification payload
config.pushNotificationPayload = userInfo

sdidReceivedHandler

SingularConfig.sdidReceivedHandler 속성

SDID(Singular Device ID)가 사용 가능해질 때(이전에 저장된 SDID 포함) 호출되는 콜백 함수를 설정합니다. result 인자는 SDID 문자열입니다.

일반적으로 didSetSdidHandler와 함께 사용됩니다. 사용자 정의 SDID를 관리할 때 두 핸들러를 모두 설정하면 SDK가 새 SDID를 수락할 때와 기존 SDID를 표시할 때 모두 알림을 받을 수 있습니다.

시그니처

typedef void (^SdidAccessorHandler)(NSString *result);
@property (copy) SdidAccessorHandler sdidReceivedHandler;

사용 예시

Swift Objective-C
// Set callback for when SDID is received
config.sdidReceivedHandler = { sdid in
    print("SDID received: \(sdid)")
    // Store or use the SDID as needed
    self.storeDeviceIdentifier(sdid)
}

setGlobalProperty

SingularConfig.setGlobalProperty 메서드

SDK 초기화 중에 글로벌 속성을 설정합니다. 이 속성은 SDK가 트래킹하는 모든 이벤트와 함께 전송됩니다. 이는 속성이 아닌 메서드로, 체인 구성을 허용합니다.

시그니처

- (void)setGlobalProperty:(NSString *)key
                withValue:(NSString *)value
         overrideExisting:(BOOL)overrideExisiting;

사용 예시

Swift Objective-C
// Add global properties
config.setGlobalProperty("app_version",
                         withValue: "1.2.3",
                         overrideExisting: true)

config.setGlobalProperty("user_type",
                         withValue: "free",
                         overrideExisting: true)

shortLinkResolveTimeOut

SingularConfig.shortLinkResolveTimeOut 속성

숏 링크 해결의 타임아웃을 초 단위로 설정합니다. 이는 초기화를 계속하기 전에 SDK가 숏 링크 해결을 얼마나 기다릴지를 결정합니다. 기본값은 10초입니다.

시그니처

@property (assign) long shortLinkResolveTimeOut;

사용 예시

Swift Objective-C
// Set short link resolve timeout to 15 seconds
config.shortLinkResolveTimeOut = 15

singularLinksHandler

SingularConfig.singularLinksHandler 속성

Singular에 의해 처리되는 딥링크를 핸들링할 콜백 함수를 설정합니다. 이를 통해 앱이 어트리뷰션에 사용되는 딥링크에 응답할 수 있습니다.

시그니처

@property (copy) void(^singularLinksHandler)(SingularLinkParams *);

사용 예시

Swift Objective-C
// Set singular links handler
config.singularLinksHandler = { params in
    guard let params = params else { return }

    // Check if we have a deep link
    if let deeplink = params.getDeepLink() {
        print("Deep link received: \(deeplink)")

        // Navigate based on the deep link
        self.navigateToScreen(deeplink)
    }

    // Check if this is a deferred deep link
    if params.isDeferred() {
        print("This is a deferred deep link")
    }

    // Access passthrough parameters
    if let passthrough = params.getPassthrough() {
        print("Passthrough data: \(passthrough)")
    }
}

skAdNetworkEnabled

SingularConfig.skAdNetworkEnabled 속성

SKAdNetwork 지원을 활성화하거나 비활성화합니다. SDK가 어트리뷰션을 위해 Apple의 SKAdNetwork를 사용할지를 제어합니다. 기본값은 YES입니다.

시그니처

@property (assign) BOOL skAdNetworkEnabled;

사용 예시

Swift Objective-C
// Disable SKAdNetwork support if needed
config.skAdNetworkEnabled = false

supportAppExtension

SingularConfig.supportAppExtension 속성

앱 익스텐션 지원을 활성화합니다. 활성화하면 SDK가 앱 익스텐션 컨텍스트에서 올바르게 작동할 수 있습니다.

시그니처

@property (assign) BOOL supportAppExtension;

사용 예시

Swift Objective-C
// Enable app extension support
config.supportAppExtension = true

userActivity

SingularConfig.userActivity 속성

유니버설 링크를 처리하기 위한 user activity 객체를 설정합니다. 앱이 유니버설 링크를 통해 열릴 때 사용됩니다.

시그니처

@property (strong) NSUserActivity *userActivity;

사용 예시

Swift Objective-C
// Set user activity for universal links
func application(_ application: UIApplication,
                 continue userActivity: NSUserActivity,
                 restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
    let config = SingularConfig(apiKey: "API_KEY", andSecret: "SECRET")
    config.userActivity = userActivity
    Singular.start(config)
    return true
}

userDetails

SingularConfig.userDetails 속성

User Details(이메일 주소 및 전화번호)를 설정 객체에 연결하여 첫 번째 세션부터 전송되도록 합니다. start를 호출하기 전에 SingularUserDetails 객체를 할당하세요. SDK는 값이 디바이스를 떠나기 전에 정규화하고 SHA-256으로 해싱하므로, 원본 이메일 주소와 전화번호는 전송되지 않습니다.

iOS SDK 버전 12.14.0 이상에서 사용할 수 있습니다. 전체 setter 목록, 검증 규칙, 런타임 setUserDetails / clearUserDetails 메서드는 유저 ID 및 해시된 User Details 설정을 참조하세요.

참고: 여기에서 설정한 값은 iOS Keychain에 저장되며 clearUserDetails를 호출할 때까지 앱 실행 간에 유지됩니다. 이후 실행에서 이 속성을 다시 할당해도 이전에 저장된 값은 삭제되지 않습니다.

중요: 이 속성은 Kids SDK 버전에서는 사용할 수 없습니다. 또한 Limit Data Sharing이 활성화된 동안에는 User Details 페이로드가 모든 요청에서 제외됩니다.

시그니처

@property (strong) SingularUserDetails *userDetails;

사용 예시

Swift Objective-C
// Attach user details at configuration time
let userDetails = SingularUserDetails()
userDetails.setEmail("user@example.com")
userDetails.setPhoneNumber("+15551234567")

config.userDetails = userDetails
Singular.start(config)

waitForTrackingAuthorizationWithTimeoutInterval

SingularConfig.waitForTrackingAuthorizationWithTimeoutInterval 속성

iOS 14 이상에서 유저의 트래킹 권한 응답을 기다리는 타임아웃 간격을 초 단위로 설정합니다. 이는 초기화를 계속하기 전에 SDK가 AppTrackingTransparency 프롬프트 응답을 얼마나 기다릴지를 결정합니다. 기본값은 0 으로, SDK가 기다리지 않고 즉시 계속됨을 의미합니다.

시그니처

@property (assign) NSInteger waitForTrackingAuthorizationWithTimeoutInterval;

사용 예시

Swift Objective-C
// Wait up to 60 seconds for ATT prompt response
config.waitForTrackingAuthorizationWithTimeoutInterval = 60

전체 구성 예시

포괄적인 SDK 구성

다음 예시는 여러 구성 속성을 함께 설정하여 포괄적인 구성을 만드는 방법을 보여줍니다.

전체 예시

Swift Objective-C
// Create configuration with API credentials
let config = SingularConfig(apiKey: "SDK KEY", andSecret: "YOUR_SECRET")

// Set basic options
config.waitForTrackingAuthorizationWithTimeoutInterval = 60
config.clipboardAttribution = true

// Set global properties
config.setGlobalProperty("app_version",
                         withValue: "1.2.3",
                         overrideExisting: true)
config.setGlobalProperty("user_type",
                         withValue: "premium",
                         overrideExisting: true)

// Configure SKAdNetwork
config.skAdNetworkEnabled = true
config.manualSkanConversionManagement = false
config.conversionValueUpdatedCallback = { conversionValue in
    print("Conversion value updated: \(conversionValue)")
}

// Configure deep links
config.launchOptions = launchOptions
config.singularLinksHandler = { params in
    if let deeplink = params?.getDeepLink() {
        print("Deep link received: \(deeplink)")
        self.handleDeepLink(deeplink)
    }
}

// Configure attribution callback (fires on a background queue)
config.deviceAttributionCallback = { attributionData in
    print("Attribution data: \(attributionData ?? [:])")
}

// Attach user details (hashed by the SDK before it is sent)
let userDetails = SingularUserDetails()
userDetails.setEmail("user@example.com")
userDetails.setPhoneNumber("+15551234567")
config.userDetails = userDetails

// Start the SDK
Singular.start(config)