iOS SDK - 구성 방법 참조

문서

iOS SDK - 구성 참조

이 문서는 iOS 애플리케이션용 Singular SDK에서 사용할 수 있는 모든 구성 옵션에 대한 포괄적인 참조를 제공합니다. SingularConfig 객체를 사용하면 추적 설정, 어트리뷰션 옵션, 개인정보 보호 제어 등을 포함하여 SDK의 동작을 사용자 지정할 수 있습니다. 각 구성 속성은 설명, 서명 및 실제 사용 예제와 함께 제공됩니다.

앱그룹명

SingularConfig.appGroupName 속성

기본 앱과 앱 확장 프로그램 간의 데이터 공유를 위한 앱 그룹 이름을 설정합니다. SDK로 앱 확장 프로그램을 사용할 때 필요합니다.

서명

@property (strong) NSString *appGroupName;

사용 예

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

clipboardAttribution

엔터프라이즈 기능: 클립보드 기반 DDL을 사용하려면 엔터프라이즈 기능인 Singular WebSDK가 필요합니다. 계정에 이 기능을 사용 설정하려면 고객 성공 매니저에게 문의하세요.

SingularConfig.clipboardAttribution 속성

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

서명

@property (assign) BOOL clipboardAttribution;

사용 예시

SwiftObjective-C
// Enable clipboard attribution
config.clipboardAttribution = true

전환값업데이트콜백

Singular 컨피규어 전환값 업데이트 콜백 속성

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

서명

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

사용 예시

SwiftObjective-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

Singular컨피그.conversionValuesUpdatedCallback 속성

SKAdNetwork 4.0 전환 값이 업데이트될 때 호출할 콜백 함수를 설정합니다. 이는 iOS 16.1 이상에만 해당되며 미세, 거친, 잠금 값의 변경에 반응할 수 있습니다.

서명

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

사용 예시

SwiftObjective-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 디바이스 ID)를 설정합니다. 이를 통해 Singular에서 생성된 장치 식별자를 사용하는 대신 고유한 장치 식별자를 제공할 수 있습니다.

서명

@property (strong) NSString *customSdid;

사용 예

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

deviceAttributionCallback

Singular 컨피규어 디바이스 어트리뷰션 콜백 속성

베타 기능: 디바이스 어트리뷰션 데이터를 사용할 수 있을 때 호출할 콜백 함수를 설정합니다. 이를 통해 어트리뷰션 데이터를 사용할 수 있게 되는 즉시 데이터에 액세스할 수 있습니다.

서명

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

사용 예시

SwiftObjective-C
// Set device attribution callback
config.deviceAttributionCallback = { attributionData in
    print("Attribution data received: \(attributionData)")

    // Access specific attribution parameters
    let campaign = attributionData["campaign"] as? String
    let source = attributionData["source"] as? String
    let adSet = attributionData["adSet"] as? String

    // Update UI or take actions based on attribution data
    if let campaign = campaign {
        self.showCampaignSpecificContent(campaign)
    }
}

didSetSdidHandler

SingularConfig.didSetSdidHandler 속성

엔터프라이즈 기능: SDID(Singular 장치 ID)가 설정될 때 호출할 콜백 함수를 설정합니다. 이를 통해 사용자 지정 SDID가 성공적으로 설정되면 알림을 받을 수 있습니다.

서명

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

사용 예

SwiftObjective-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
}

enableOdmWithTimeoutInterval

SingularConfig.enableOdmWithTimeoutInterval 속성

Google ODM(오가닉 데이터 측정) 검색을 위한 시간 초과 간격을 초 단위로 설정합니다. 이 기능은 구글 플레이에서 오가닉 인스톨 데이터를 검색하는 데 사용됩니다.

서명

@property (assign) NSInteger enableOdmWithTimeoutInterval;

사용 예시

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

espDomains

SingularConfig.espDomains 속성

이메일 어트리뷰션에 사용할 ESP(이메일 서비스 제공업체) 도메인을 설정합니다. 이를 통해 어트리뷰션에 고려할 이메일 도메인을 지정할 수 있습니다.

서명

@property (strong) NSArray *espDomains;

사용 예

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

글로벌 프로퍼티

SingularConfig.globalProperties 속성

글로벌 속성 사전에 대한 읽기 전용 액세스를 제공합니다. 여기에는 구성에 대해 설정된 모든 전역 프로퍼티가 포함됩니다.

서명

@property (readonly) NSMutableDictionary *globalProperties;

사용 예시

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

initWithApiKey

SingularConfig 초기화

API 키와 시크릿을 사용하여 새 SingularConfig 객체를 초기화합니다. 이는 Singular SDK를 구성하는 첫 번째 단계입니다.

서명

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

사용 예시

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

launchOptions

SingularConfig.launchOptions 속성

앱 델리게이트에서 실행 옵션 사전을 설정합니다. 딥링크 및 기타 실행 데이터를 처리하는 데 사용됩니다.

서명

@property (strong) NSDictionary *launchOptions;

사용 예시

SwiftObjective-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가 추적 및 어트리뷰션을 위해 디바이스 식별자를 수집하고 사용하는 방식에 영향을 줍니다.

서명

@property (assign) BOOL limitAdvertisingIdentifiers;

사용 예시

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

수동스캔컨버젼관리

SingularConfig.manualSkanConversionManagement 속성

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

서명

@property (assign) BOOL manualSkanConversionManagement;

사용 예시

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

openUrl

SingularConfig.openUrl 속성

앱을 여는 데 사용되는 URL을 설정합니다. 이 프로퍼티는 사용자 지정 URL 체계 딥링크에 사용됩니다.

서명

@property (strong) NSURL *openUrl;

사용 예시

SwiftObjective-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
}

푸시알림링크경로

SingularConfig.pushNotificationLinkPath 속성

푸시 알림 페이로드에서 딥링크를 찾을 경로를 설정합니다. 이를 통해 SDK가 푸시 알림에서 어트리뷰션 링크를 찾고 처리하는 데 도움이 됩니다.

서명

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

사용 예시

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

pushNotificationPayload

SingularConfig.pushNotificationPayload 속성

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

서명

@property (strong) NSDictionary *pushNotificationPayload;

사용 예시

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

sdidReceivedHandler

SingularConfig.sdidReceivedHandler 속성

엔터프라이즈 기능: SDID(Singular 장치 ID)를 수신할 때 호출할 콜백 함수를 설정합니다. 이를 통해 SDID를 사용할 수 있게 되는 즉시 액세스할 수 있습니다.

서명

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

사용 예

SwiftObjective-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;

사용 예시

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

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

shortLinkResolveTimeOut

Singular 컨피규어 단축 링크 해결 시간 제한 속성

짧은 링크 확인에 대한 시간 제한을 초 단위로 설정합니다. 이 값은 SDK가 초기화를 계속하기 전에 짧은 링크가 해결될 때까지 기다리는 시간을 결정합니다. 기본값은 10초입니다.

서명

@property (assign) long shortLinkResolveTimeOut;

사용 예시

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

singularLinksHandler

Singular 컨피규어 Singular링크 핸들러 속성

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

시그니처

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

사용 예시

SwiftObjective-C
// Set singular links handler
config.singularLinksHandler = { params in
    // Check if we have a deep link
    if let deeplink = params.deeplink {
        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.passthrough {
        print("Passthrough data: \(passthrough)")
    }
}

skAdNetworkEnabled

Singular컨피그.skAdNetworkEnabled 속성

SKAdNetwork 지원을 활성화 또는 비활성화합니다. SDK가 어트리뷰션에 Apple의 SKAdNetwork를 사용할지 여부를 제어합니다. 기본값은 YES입니다.

서명

@property (assign) BOOL skAdNetworkEnabled;

사용 예시

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

지원앱확장

Singular컨피그.지원앱확장 속성

앱 확장 지원을 활성화합니다. 활성화하면 SDK가 앱 확장 컨텍스트에서 제대로 작동할 수 있습니다.

서명

@property (assign) BOOL supportAppExtension;

사용 예제

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

userActivity

SingularConfig.userActivity 속성

유니버설 링크 처리를 위한 사용자 활동 객체를 설정합니다. 유니버설 링크를 통해 앱이 열릴 때 사용됩니다.

서명

@property (strong) NSUserActivity *userActivity;

사용 예시

SwiftObjective-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
}

waitForTrackingAuthorizationWithTimeoutInterval

SingularConfig.waitForTrackingAuthorizationWithTimeoutInterval 속성

iOS 14+에서 사용자의 추적 권한 부여 응답을 기다리는 시간 초과 간격을 초 단위로 설정합니다. 이 프로퍼티는 SDK가 초기화를 계속하기 전에 ATT 프롬프트 응답을 기다리는 시간을 결정합니다.

서명

@property (assign) NSInteger waitForTrackingAuthorizationWithTimeoutInterval;

사용 예제

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

전체 구성 예제

포괄적인 SDK 구성

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

전체 예제

SwiftObjective-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.deeplink {
        print("Deep link received: \(deeplink)")
        self.handleDeepLink(deeplink)
    }
}

// Configure attribution callback
config.deviceAttributionCallback = { attributionData in
    print("Attribution data: \(attributionData)")
}

// Start the SDK
Singular.start(config)