iOS SDK - 메서드 레퍼런스
이 종합 레퍼런스는 iOS 애플리케이션용 Singular SDK에서 사용 가능한 모든 메서드를 문서화합니다. 이 SDK는 초기화, 이벤트 트래킹, 매출 보고, 어트리뷰션, 데이터 프라이버시 준수, 그리고 구성을 위한 기능을 제공합니다. 각 메서드는 설명, 시그니처, 그리고 실용적인 사용 예시와 함께 제공되어 개발자가 Singular SDK 기능을 애플리케이션에 연동할 수 있도록 돕습니다.
adRevenue
Singular.adRevenue 메서드
상세한 광고 데이터 정보로 광고 매출 이벤트를 트래킹합니다. 이 메서드를 통해 애플리케이션에 표시되는 광고에서 발생한 매출을 다양한 파라미터로 분류하고 광고 성과를 분석하기 위해 보고할 수 있습니다.
시그니처
+ (void)adRevenue:(SingularAdData *)adData;
사용 예시
// Create ad data object
let adData = SingularAdData(adPlatform: "AdMob",
withCurrency: "USD",
withRevenue: 0.05)
adData.adUnitId = "ca-app-pub-123456789/1234567890"
adData.adType = "Rewarded"
adData.adPlacementName = "level_complete"
// Track ad revenue event
Singular.adRevenue(adData)
// Create ad data object
SingularAdData *adData = [[SingularAdData alloc] initWithAdPlatform:@"AdMob"
withCurrency:@"USD"
withRevenue:0.05];
adData.adUnitId = @"ca-app-pub-123456789/1234567890";
adData.adType = @"Rewarded";
adData.adPlacementName = @"level_complete";
// Track ad revenue event
[Singular adRevenue:adData];
clearGlobalProperties
Singular.clearGlobalProperties 메서드
이전에 설정한 모든 글로벌 속성을 제거합니다. 예를 들어 유저가 애플리케이션에서 로그아웃할 때처럼 글로벌 속성을 재설정해야 할 때 유용합니다.
시그니처
+ (void)clearGlobalProperties;
사용 예시
// Clear all global properties
Singular.clearGlobalProperties()
// Clear all global properties
[Singular clearGlobalProperties];
createReferrerShortLink
Singular.createReferrerShortLink 메서드
공유 및 어트리뷰션에 사용할 수 있는 추천인 정보가 포함된 단축 링크를 생성합니다. 이 메서드는 유저와 공유할 수 있는 트래킹 가능한 링크를 생성하여 특정 추천 소스에 설치 및 활동을 어트리뷰션할 수 있게 합니다.
시그니처
+ (void)createReferrerShortLink:(NSString *)baseLink
referrerName:(NSString *)referrerName
referrerId:(NSString *)referrerId
completionHandler:(void (^)(NSString *, NSError *))completionHandler;
+ (void)createReferrerShortLink:(NSString *)baseLink
referrerName:(NSString *)referrerName
referrerId:(NSString *)referrerId
passthroughParams:(NSDictionary *)passthroughParams
completionHandler:(void (^)(NSString *, NSError *))completionHandler;
사용 예시
// Create a short link for referral
Singular.createReferrerShortLink("https://sample.sng.link/B4tbm/v8fp",
referrerName: "John Doe",
referrerId: "aq239897",
passthroughParams: [
"channel": "sms",
"campaign": "summer_promo"
]) { link, error in
if let error = error {
print("Error creating short link: \(error)")
} else if let link = link {
print("Generated short link: \(link)")
// Share the link with users
}
}
// Create a short link for referral
[Singular createReferrerShortLink:@"https://sample.sng.link/B4tbm/v8fp"
referrerName:@"John Doe"
referrerId:@"aq239897"
passthroughParams:@{
@"channel": @"sms",
@"campaign": @"summer_promo"
}
completionHandler:^(NSString *link, NSError *error) {
if (error) {
NSLog(@"Error creating short link: %@", error);
} else {
NSLog(@"Generated short link: %@", link);
// Share the link with users
}
}];
customRevenue
Singular.customRevenue 메서드
지정된 이벤트 이름, 통화, 금액 및 선택적 제품 정보로 커스텀 매출 이벤트를 트래킹합니다. 이를 통해 커스텀 이벤트 이름으로 보다 구체적인 매출 트래킹이 가능합니다.
시그니처
+ (void)customRevenue:(NSString *)eventname
transaction:(id)transaction;
+ (void)customRevenue:(NSString *)eventname
transaction:(id)transaction
withAttributes:(NSDictionary *)attributes;
+ (void)customRevenue:(NSString *)eventname
currency:(NSString *)currency
amount:(double)amount;
+ (void)customRevenue:(NSString *)eventname
currency:(NSString *)currency
amount:(double)amount
withAttributes:(NSDictionary *)attributes;
+ (void)customRevenue:(NSString *)eventname
currency:(NSString *)currency
amount:(double)amount
productSKU:(NSString *)productSKU
productName:(NSString *)productName
productCategory:(NSString *)productCategory
productQuantity:(int)productQuantity
productPrice:(double)productPrice;
+ (void)customRevenue:(NSData *)transactionJsonRepresentation
productJsonRepresentation:(NSData *)productJsonRepresentation;
+ (void)customRevenue:(NSString *)eventName
transactionJsonRepresentation:(NSData *)transactionJsonRepresentation
productJsonRepresentation:(NSData *)productJsonRepresentation;
+ (void)customRevenue:(NSString *)eventName
transactionJsonRepresentation:(NSData *)transactionJsonRepresentation
productJsonRepresentation:(NSData *)productJsonRepresentation
withAttributes:(NSDictionary *)attributes;
사용 예시
// Track a custom revenue event
Singular.customRevenue("premium_subscription",
currency: "USD",
amount: 9.99)
// Track a custom revenue event with attributes
Singular.customRevenue("in_app_purchase",
currency: "USD",
amount: 5.99,
withAttributes: [
"product_id": "com.app.gems_pack_small",
"quantity": 1
])
// Track a custom revenue event from a StoreKit transaction
if let transactionData = transaction.payment.requestData,
let productData = try? JSONSerialization.data(withJSONObject: [
"productID": transaction.payment.productIdentifier
]) {
Singular.customRevenue("in_app_purchase",
transactionJsonRepresentation: transactionData,
productJsonRepresentation: productData,
withAttributes: ["source": "store"])
}
// Track a custom revenue event
[Singular customRevenue:@"premium_subscription"
currency:@"USD"
amount:9.99];
// Track a custom revenue event with attributes
[Singular customRevenue:@"in_app_purchase"
currency:@"USD"
amount:5.99
withAttributes:@{
@"product_id": @"com.app.gems_pack_small",
@"quantity": @1
}];
// Track a custom revenue event from a StoreKit transaction
NSData *transactionData = transaction.payment.requestData;
NSData *productData = [NSJSONSerialization
dataWithJSONObject:@{@"productID": transaction.payment.productIdentifier}
options:0
error:nil];
if (transactionData && productData) {
[Singular customRevenue:@"in_app_purchase"
transactionJsonRepresentation:transactionData
productJsonRepresentation:productData
withAttributes:@{@"source": @"store"}];
}
event
Singular.event 메서드
지정된 이름과 선택적 커스텀 속성으로 이벤트를 트래킹합니다. 이러한 메서드를 사용하여 애플리케이션 내에서 유저의 행동 및 참여를 트래킹하세요.
시그니처
+ (void)event:(NSString *)name;
+ (void)event:(NSString *)name withArgs:(NSDictionary *)args;
+ (void)eventWithArgs:(NSString *)name, ...;
사용 예시
// Track a simple event
Singular.event("level_completed")
// Track an event with additional parameters
Singular.event("level_completed", withArgs: [
"level_id": 5,
"score": 12500,
"time_spent": 120,
"difficulty": "medium"
])
// Track a simple event
[Singular event:@"level_completed"];
// Track an event with additional parameters
[Singular event:@"level_completed"
withArgs:@{
@"level_id": @5,
@"score": @12500,
@"time_spent": @120,
@"difficulty": @"medium"
}];
// Track an event with variable arguments
[Singular eventWithArgs:@"purchase",
@"item_id", @"sword_01",
@"price", @9.99,
nil];
getGlobalProperties
Singular.getGlobalProperties 메서드
현재 설정된 모든 글로벌 속성을 검색합니다. 이 메서드는 SDK에 설정된 모든 글로벌 속성을 포함하는 딕셔너리를 반환합니다.
시그니처
+ (NSDictionary *)getGlobalProperties;
사용 예시
// Get all global properties
let properties = Singular.getGlobalProperties()
print("Global properties: \(properties)")
// Get all global properties
NSDictionary *properties = [Singular getGlobalProperties];
NSLog(@"Global properties: %@", properties);
getLimitDataSharing
Singular.getLimitDataSharing 메서드
현재 데이터 공유 제한 상태를 검색합니다. 이 메서드는 데이터 공유가 현재 제한되어 있는지 여부를 나타내는 부울 값을 반환합니다.
시그니처
+ (BOOL)getLimitDataSharing;
사용 예시
// Check if data sharing is limited
let isLimited = Singular.getLimitDataSharing()
if isLimited {
print("Data sharing is currently limited")
}
// Check if data sharing is limited
BOOL isLimited = [Singular getLimitDataSharing];
if (isLimited) {
NSLog(@"Data sharing is currently limited");
}
handlePushNotification
Singular.handlePushNotification 메서드
어트리뷰션을 위한 푸시 알림 페이로드를 처리합니다. 이 메서드는 앱이 푸시 알림을 수신할 때 Singular가 이를 올바르게 어트리뷰션할 수 있도록 호출되어야 합니다.
시그니처
+ (BOOL)handlePushNotification:(NSDictionary *)pushNotificationPayload;
사용 예시
// Handle a received push notification
func userNotificationCenter(_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void) {
let userInfo = response.notification.request.content.userInfo
Singular.handlePushNotification(userInfo)
completionHandler()
}
// Handle a received push notification
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
withCompletionHandler:(void (^)(void))completionHandler {
NSDictionary *userInfo = response.notification.request.content.userInfo;
[Singular handlePushNotification:userInfo];
completionHandler();
}
iapComplete
Singular.iapComplete 메서드
인앱 구매 완료 이벤트를 트래킹합니다. 이러한 메서드는 인앱 구매 트랜잭션이 완료될 때 호출되어야 합니다.
시그니처
+ (void)iapComplete:(id)transaction;
+ (void)iapComplete:(id)transaction
withName:(NSString *)name;
+ (void)iapComplete:(id)transaction
withAttributes:(id)value, ...;
+ (void)iapComplete:(id)transaction
withName:(NSString *)name
withAttributes:(id)value, ...;
사용 예시
// Track IAP completion
Singular.iapComplete(transaction)
// Track IAP completion with custom name
Singular.iapComplete(transaction, withName: "premium_upgrade")
// Track IAP completion
[Singular iapComplete:transaction];
// Track IAP completion with custom name
[Singular iapComplete:transaction
withName:@"premium_upgrade"];
// Track IAP completion with attributes
[Singular iapComplete:transaction
withAttributes:@"user_level", @42,
@"is_first_purchase", @YES,
nil];
isAllTrackingStopped
Singular.isAllTrackingStopped 메서드
모든 트래킹이 현재 중지되었는지 확인합니다. 이 메서드는 트래킹이 현재 중지되었는지 여부를 나타내는 부울 값을 반환합니다.
시그니처
+ (BOOL)isAllTrackingStopped;
사용 예시
// Check if tracking is stopped
if Singular.isAllTrackingStopped() {
print("Tracking is currently stopped")
}
// Check if tracking is stopped
if ([Singular isAllTrackingStopped]) {
NSLog(@"Tracking is currently stopped");
}
isSingularLink
Singular.isSingularLink 메서드
주어진 링크 홀더(일반적으로
NSURL
또는
NSUserActivity)가 Singular Link를 나타내는지 여부를 반환합니다. SDK의
singularLinksHandler를 통해 Singular가 링크를 처리할 예정인 경우, 자체 딥링크 처리를 단축시키는 데 사용하세요.
시그니처
+ (BOOL)isSingularLink:(id)linkHolder;
사용 예시
// Inspect an incoming URL before handling it yourself
func application(_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
if Singular.isSingularLink(url) {
// Singular's singularLinksHandler will receive the resolved link.
return true
}
// Fall through to your own deep-link handling
return handleCustomURL(url)
}
// Inspect an incoming URL before handling it yourself
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
if ([Singular isSingularLink:url]) {
// Singular's singularLinksHandler will receive the resolved link.
return YES;
}
return [self handleCustomURL:url];
}
limitDataSharing
Singular.limitDataSharing 메서드
데이터 공유 제한 상태를 설정합니다. 유저 동의 또는 프라이버시 요구사항에 따라 데이터 공유를 제한하려면 이 메서드를 사용하세요.
시그니처
+ (void)limitDataSharing:(BOOL)shouldLimitDataSharing;
사용 예시
// To limit data sharing (e.g., when user opts out)
Singular.limitDataSharing(true)
// To enable full data sharing (e.g., when user opts in)
Singular.limitDataSharing(false)
// To limit data sharing (e.g., when user opts out)
[Singular limitDataSharing:YES];
// To enable full data sharing (e.g., when user opts in)
[Singular limitDataSharing:NO];
registerDeviceTokenForUninstall
Singular.registerDeviceTokenForUninstall 메서드
앱 삭제 트래킹을 위해 디바이스 토큰을 등록합니다. 이 메서드는 앱 삭제 트래킹을 활성화하기 위해 푸시 알림 토큰과 함께 호출되어야 합니다.
시그니처
+ (void)registerDeviceTokenForUninstall:(NSData *)deviceToken;
사용 예시
// Register device token for uninstall tracking
func application(_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
Singular.registerDeviceTokenForUninstall(deviceToken)
}
// Register device token for uninstall tracking
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[Singular registerDeviceTokenForUninstall:deviceToken];
}
resumeAllTracking
Singular.resumeAllTracking 메서드
이전에 중지되었던 모든 트래킹 활동을 재개합니다. 트래킹이 중지된 후 다시 활성화하려면 이 메서드를 사용하세요.
시그니처
+ (void)resumeAllTracking;
사용 예시
// Resume tracking when user opts back in
Singular.resumeAllTracking()
// Resume tracking when user opts back in
[Singular resumeAllTracking];
revenue
Singular.revenue 메서드
통화, 금액, 제품 세부 정보 등 다양한 파라미터로 매출 이벤트를 트래킹합니다. 이를 통해 애플리케이션에 대한 종합적인 매출 트래킹이 가능합니다.
시그니처
+ (void)revenue:(id)transaction;
+ (void)revenue:(id)transaction withAttributes:(NSDictionary *)attributes;
+ (void)revenue:(NSString *)currency amount:(double)amount;
+ (void)revenue:(NSString *)currency
amount:(double)amount
withAttributes:(NSDictionary *)attributes;
+ (void)revenue:(NSString *)currency
amount:(double)amount
productSKU:(NSString *)productSKU
productName:(NSString *)productName
productCategory:(NSString *)productCategory
productQuantity:(int)productQuantity
productPrice:(double)productPrice;
사용 예시
// Track revenue with currency and amount
Singular.revenue("USD", amount: 9.99)
// Track revenue with additional attributes
Singular.revenue("USD", amount: 19.98, withAttributes: [
"product_id": "premium_gems",
"quantity": 2
])
// Track revenue with detailed product information
Singular.revenue("USD",
amount: 19.98,
productSKU: "SKU123456",
productName: "Premium Sword",
productCategory: "Weapons",
productQuantity: 2,
productPrice: 9.99)
// Track revenue from a StoreKit SKPaymentTransaction
// (typically inside SKPaymentTransactionObserver.paymentQueue(_:updatedTransactions:))
func paymentQueue(_ queue: SKPaymentQueue,
updatedTransactions transactions: [SKPaymentTransaction]) {
for transaction in transactions where transaction.transactionState == .purchased {
Singular.revenue(transaction)
SKPaymentQueue.default().finishTransaction(transaction)
}
}
// Track revenue with currency and amount
[Singular revenue:@"USD" amount:9.99];
// Track revenue with additional attributes
[Singular revenue:@"USD"
amount:19.98
withAttributes:@{
@"product_id": @"premium_gems",
@"quantity": @2
}];
// Track revenue with detailed product information
[Singular revenue:@"USD"
amount:19.98
productSKU:@"SKU123456"
productName:@"Premium Sword"
productCategory:@"Weapons"
productQuantity:2
productPrice:9.99];
// Track revenue from a StoreKit SKPaymentTransaction
// (typically inside paymentQueue:updatedTransactions:)
- (void)paymentQueue:(SKPaymentQueue *)queue
updatedTransactions:(NSArray<SKPaymentTransaction *> *)transactions {
for (SKPaymentTransaction *transaction in transactions) {
if (transaction.transactionState == SKPaymentTransactionStatePurchased) {
[Singular revenue:transaction];
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
}
}
}
setCustomUserId
Singular.setCustomUserId 메서드
현재 유저에 대해 커스텀 유저 ID를 설정합니다. 이를 통해 Singular 데이터를 자체 유저 식별 시스템과 연결할 수 있습니다.
시그니처
+ (void)setCustomUserId:(NSString *)customUserId;
사용 예시
// Set custom user ID after user logs in
Singular.setCustomUserId("user_123456")
// Set custom user ID after user logs in
[Singular setCustomUserId:@"user_123456"];
setDeviceCustomUserId
지원 중단된 기능: 대신 setCustomUserId를 사용하세요.
Singular.setDeviceCustomUserId 메서드
디바이스 수준에서 커스텀 유저 ID를 설정합니다. 이를 통해 Singular 데이터를 디바이스 수준에서 자체 유저 식별 시스템과 연결할 수 있습니다.
시그니처
+ (void)setDeviceCustomUserId:(NSString *)customUserId;
사용 예시
// Set device-level custom user ID
Singular.setDeviceCustomUserId("device_user_123456")
// Set device-level custom user ID
[Singular setDeviceCustomUserId:@"device_user_123456"];
setGlobalProperty
Singular.setGlobalProperty 메서드
모든 이벤트와 함께 전송되는 글로벌 속성을 설정합니다. 이를 통해 매번 지정하지 않고도 모든 이벤트에 일관된 속성을 추가할 수 있습니다.
시그니처
+ (BOOL)setGlobalProperty:(NSString *)key
andValue:(NSString *)value
overrideExisting:(BOOL)overrideExisting;
사용 예시
// Set a global property
let success = Singular.setGlobalProperty("user_tier",
andValue: "premium",
overrideExisting: true)
if success {
print("Global property set successfully")
}
// Set a global property
BOOL success = [Singular setGlobalProperty:@"user_tier"
andValue:@"premium"
overrideExisting:YES];
if (success) {
NSLog(@"Global property set successfully");
}
setLimitAdvertisingIdentifiers
Singular.setLimitAdvertisingIdentifiers 메서드
런타임에 광고 식별자 수집 제한을 활성화 또는 비활성화합니다. 이는 구성 시 속성
SingularConfig.limitAdvertisingIdentifiers의 런타임 등가물이며,
Singular.start(_:) 이후 어느 시점에서나 전환할 수 있습니다.
이 메서드는 Singular Kids SDK 빌드에서 컴파일되지 않습니다(
#ifndef SINGULAR_KIDS로 보호됨).
Singular-Kids-SDK를 연동하는 경우, 이 메서드는 사용할 수 없습니다. Kids SDK는 자동으로 더 엄격한 식별자 처리를 적용합니다.
시그니처
+ (void)setLimitAdvertisingIdentifiers:(BOOL)enabled;
사용 예시
// Limit advertising identifiers at runtime (e.g., after a consent dialog)
Singular.setLimitAdvertisingIdentifiers(true)
// Limit advertising identifiers at runtime (e.g., after a consent dialog)
[Singular setLimitAdvertisingIdentifiers:YES];
setLoggingEnabled
Singular.setLoggingEnabled 메서드
런타임에 SDK 로깅을 전환합니다.
SingularConfig.enableLogging의 런타임 대응 메서드입니다. 이 값이
YES로 설정되고
setLogLevel:이
SingularLogLevelNone보다 높게 설정되어야만 로깅이 활성화됩니다.
시그니처
+ (void)setLoggingEnabled:(BOOL)enabled;
사용 예시
// Enable SDK logging for debug builds
#if DEBUG
Singular.setLoggingEnabled(true)
Singular.setLogLevel(.debug)
#endif
// Enable SDK logging for debug builds
#ifdef DEBUG
[Singular setLoggingEnabled:YES];
[Singular setLogLevel:SingularLogLevelDebug];
#endif
setLogLevel
Singular.setLogLevel 메서드
런타임에 SDK 로그 상세 수준을 설정합니다.
SingularConfig.logLevel의 런타임 대응 메서드입니다. 사용 가능한 레벨은
SingularLogLevel.h에 정의되어 있습니다:
SingularLogLevelNone,
SingularLogLevelError,
SingularLogLevelWarning,
SingularLogLevelInfo,
SingularLogLevelDebug,
SingularLogLevelVerbose.
시그니처
+ (void)setLogLevel:(SingularLogLevel)logLevel;
사용 예시
// Set verbose logging for detailed debugging
Singular.setLoggingEnabled(true)
Singular.setLogLevel(.verbose)
// Set verbose logging for detailed debugging
[Singular setLoggingEnabled:YES];
[Singular setLogLevel:SingularLogLevelVerbose];
setSessionTimeout
Singular.setSessionTimeout 메서드
세션 타임아웃을 초 단위로 설정합니다. 이는 앱이 백그라운드로 전환된 후 유저 세션이 얼마나 지속되는지를 결정합니다.
시그니처
+ (void)setSessionTimeout:(int)timeout;
사용 예시
// Set session timeout to 2 minutes
Singular.setSessionTimeout(120)
// Set session timeout to 2 minutes
[Singular setSessionTimeout:120];
skanGetConversionValue
Singular.skanGetConversionValue 메서드
현재 SKAdNetwork 컨버전 값을 검색합니다. 이 메서드는 SKAdNetwork 어트리뷰션에 사용되는 현재 컨버전 값을 반환합니다.
시그니처
+ (NSNumber *)skanGetConversionValue;
사용 예시
// Get the current SKAdNetwork conversion value
let conversionValue = Singular.skanGetConversionValue()
print("Current conversion value: \(conversionValue ?? 0)")
// Get the current SKAdNetwork conversion value
NSNumber *conversionValue = [Singular skanGetConversionValue];
NSLog(@"Current conversion value: %@", conversionValue);
skanRegisterAppForAdNetworkAttribution
Singular.skanRegisterAppForAdNetworkAttribution 메서드
SKAdNetwork 어트리뷰션을 위해 앱을 등록합니다. iOS에서 SKAdNetwork 어트리뷰션을 활성화하려면 이 메서드를 호출해야 합니다.
시그니처
+ (void)skanRegisterAppForAdNetworkAttribution;
사용 예시
// Register for SKAdNetwork attribution
Singular.skanRegisterAppForAdNetworkAttribution()
// Register for SKAdNetwork attribution
[Singular skanRegisterAppForAdNetworkAttribution];
skanUpdateConversionValue
Singular.skanUpdateConversionValue 메서드
SKAdNetwork 컨버전 값을 업데이트합니다. 이러한 메서드를 통해 SKAdNetwork 어트리뷰션에 사용되는 컨버전 값을 수동으로 업데이트할 수 있습니다.
시그니처
+ (BOOL)skanUpdateConversionValue:(NSInteger)conversionValue;
+ (void)skanUpdateConversionValue:(NSInteger)conversionValue
coarse:(NSInteger)coarse
lock:(BOOL)lock;
사용 예시
// Update the SKAdNetwork conversion value
let success = Singular.skanUpdateConversionValue(5)
if success {
print("Conversion value updated successfully")
}
// Update SKAdNetwork 4.0 conversion values (iOS 16.1+)
Singular.skanUpdateConversionValue(5, // fine value (0-63)
coarse: 1, // coarse value (0=low, 1=medium, 2=high)
lock: false)
// Update the SKAdNetwork conversion value
BOOL success = [Singular skanUpdateConversionValue:5];
if (success) {
NSLog(@"Conversion value updated successfully");
}
// Update SKAdNetwork 4.0 conversion values (iOS 16.1+)
[Singular skanUpdateConversionValue:5 // fine value (0-63)
coarse:1 // coarse value (0=low, 1=medium, 2=high)
lock:NO];
start
Singular.start 메서드
제공된 구성으로 Singular SDK를 초기화합니다. 이는 Singular SDK 사용을 시작하기 위해 가장 먼저 호출해야 하는 메서드입니다.
시그니처
+ (BOOL)start:(SingularConfig *)config;
사용 예시
// Create configuration object
let config = SingularConfig(apiKey: "SDK_KEY", andSecret: "SDK_SECRET")
// Configure additional options if needed
config.customUserId = "user-123456"
config.sessionTimeout = 60
// Initialize the SDK
Singular.start(config)
// Create configuration object
SingularConfig *config = [[SingularConfig alloc] initWithApiKey:@"SDK_KEY" andSecret:@"SDK_SECRET"];
// Configure additional options if needed
config.customUserId = @"user-123456";
config.sessionTimeout = 60;
// Initialize the SDK
[Singular start:config];
startSession
Singular.startSession 메서드
Singular SDK로 새 세션을 시작합니다. 런치 옵션, 유저 액티비티, 딥링크 처리 등 다양한 초기화 시나리오에 맞게 여러 변형이 제공됩니다.
시그니처
+ (void)startSession:(NSString *)apiKey withKey:(NSString *)apiSecret;
+ (BOOL)startSession:(NSString *)apiKey
withKey:(NSString *)apiSecret
andLaunchOptions:(NSDictionary *)launchOptions
withSingularLinkHandler:(void (^)(SingularLinkParams *))handler;
+ (BOOL)startSession:(NSString *)apiKey
withKey:(NSString *)apiSecret
andLaunchOptions:(NSDictionary *)launchOptions
withSingularLinkHandler:(void (^)(SingularLinkParams *))handler
andShortLinkResolveTimeout:(long)timeoutSec;
+ (void)startSession:(NSString *)apiKey
withKey:(NSString *)apiSecret
andLaunchOptions:(NSDictionary *)launchOptions;
사용 예시
// Simple session start
Singular.startSession("API_KEY", withKey: "API_SECRET")
// Session start with deep link handler
Singular.startSession("API_KEY",
withKey: "API_SECRET",
andLaunchOptions: launchOptions,
withSingularLinkHandler: { params in
if let deeplink = params.deeplink {
print("Deep link received: \(deeplink)")
}
})
// Simple session start
[Singular startSession:@"API_KEY" withKey:@"API_SECRET"];
// Session start with deep link handler
[Singular startSession:@"API_KEY"
withKey:@"API_SECRET"
andLaunchOptions:launchOptions
withSingularLinkHandler:^(SingularLinkParams *params) {
NSLog(@"Deep link received: %@", params.deeplink);
}];
stopAllTracking
Singular.stopAllTracking 메서드
모든 트래킹 활동을 중지합니다. 유저가 옵트아웃하거나 프라이버시 준수를 위해 트래킹을 비활성화하려면 이 메서드를 사용하세요.
시그니처
+ (void)stopAllTracking;
사용 예시
// Stop tracking when user opts out
Singular.stopAllTracking()
// Stop tracking when user opts out
[Singular stopAllTracking];
trackingOptIn
Singular.trackingOptIn 메서드
유저가 트래킹에 옵트인했음을 나타냅니다. 유저가 트래킹 및 데이터 수집에 명시적으로 동의할 때 이 메서드를 호출하세요.
시그니처
+ (void)trackingOptIn;
사용 예시
// User has opted in to tracking
Singular.trackingOptIn()
// User has opted in to tracking
[Singular trackingOptIn];
trackingUnder13
Singular.trackingUnder13 메서드
유저가 13세 미만임을 나타냅니다. 13세 미만 유저에 대한 COPPA 및 기타 규정을 준수하기 위해 이 메서드를 호출하세요.
시그니처
+ (void)trackingUnder13;
사용 예시
// Notify Singular the user is under 13 years old
Singular.trackingUnder13()
// Notify Singular the user is under 13 years old
[Singular trackingUnder13];
unsetCustomUserId
Singular.unsetCustomUserId 메서드
이전에 설정된 커스텀 유저 ID를 제거합니다. 유저가 로그아웃하거나 더 이상 현재 유저 ID와 이벤트를 연결하지 않으려는 경우 이 메서드를 호출하세요.
시그니처
+ (void)unsetCustomUserId;
사용 예시
// Clear custom user ID when user logs out
Singular.unsetCustomUserId()
// Clear custom user ID when user logs out
[Singular unsetCustomUserId];
unsetGlobalProperty
Singular.unsetGlobalProperty 메서드
이전에 설정된 글로벌 속성을 제거합니다. 특정 글로벌 속성이 더 이상 이벤트와 함께 전송되지 않도록 하려면 이 메서드를 호출하세요.
시그니처
+ (void)unsetGlobalProperty:(NSString *)key;
사용 예시
// Remove a global property
Singular.unsetGlobalProperty("user_tier")
// Remove a global property
[Singular unsetGlobalProperty:@"user_tier"];