iOS
AdStage In-App Event Integration Guide (iOS)
Table of Contents
- Overview
- Basic Setup
- Type-Safe Event Sending
- Standard Event Catalog
- Examples by Event Type
- Best Practices
- Troubleshooting
Overview
AdStage in-app events track user behavior and app events to support marketing analytics and optimization.
Key Features
- Global context management: Set user/device information once and it is automatically included
- Simple API: Send events easily with just an event name and parameters
- Automatic session tracking: Session IDs are generated and managed automatically
- Asynchronous processing: Network communication does not block the UI
- Offline support: Automatic resend when the network recovers
Basic Setup
CocoaPods Setup
Podfile
platform :ios, '15.0'
target 'YourApp' do
use_frameworks!
# AdStage SDK
pod 'AdapterAdStage', '3.0.11'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0'
end
end
endInstall:
pod install2. SDK Initialization
import AdapterAdStage
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
// AdStage 초기화
AdStageManager.shared.initialize(
apiKey: "your-api-key-here",
serverUrl: "https://api.adstage.app"
)
print("✅ AdStage SDK 초기화 완료")
return true
}
}3. Info.plist Setup
<!-- 네트워크 사용 권한 -->
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
</dict>Type-Safe Event Sending
1. The Simplest Approach
import AdapterAdStage
// 파라미터 없는 이벤트
AdStageManager.shared.trackEvent(AdStageEvent.FirstOpen())
// 로그인 이벤트
AdStageManager.shared.trackEvent(
AdStageEvent.Login(method: .email)
)2. Purchase Event (Validation Example)
// ✅ GOOD: value와 currency 함께 제공
AdStageManager.shared.trackEvent(
AdStageEvent.Purchase(
value: 29.99,
currency: "USD",
transactionId: "TXN_123456"
)
)
// ❌ BAD: value만 제공 시 컴파일 에러!
AdStageManager.shared.trackEvent(
AdStageEvent.Purchase(
value: 29.99 // ❌ 에러: currency 필수!
)
)
// ✅ GOOD: currency 없이 transactionId만
AdStageManager.shared.trackEvent(
AdStageEvent.Purchase(
transactionId: "TXN_123456"
)
)3. Product View
// 파라미터와 함께
AdStageManager.shared.trackEvent(
AdStageEvent.ProductDetailsView(
itemId: "PROD_123",
itemName: "Wireless Earbuds"
)
)
// 파라미터 없이
AdStageManager.shared.trackEvent(AdStageEvent.ProductListView())4. Custom Event (event_name Auto-Promotion)
To send app-specific events beyond the standard events, use AdStageEvent.Custom.
If you include an event_name key in the parameters, that value is automatically promoted to the actual event name and stored in the dashboard.
// 예: 'promotion_click'이라는 커스텀 이벤트 전송
AdStageManager.shared.trackEvent(
AdStageEvent.Custom(
params: [
"event_name": "promotion_click",
"promotion_id": "summer_sale_2025",
"screen": "home_banner"
]
)
)
// 대시보드에는 "promotion_click" 이벤트로 수집됨
// event_name 없이 일반 커스텀 이벤트
AdStageManager.shared.trackEvent(
AdStageEvent.Custom(
params: [
"action": "button_click",
"button_id": "promo_banner",
"screen": "home",
"timestamp": Date().timeIntervalSince1970
]
)
)
// 대시보드에는 "custom" 이벤트로 수집됨
// Click, View도 자유 파라미터 지원
AdStageManager.shared.trackEvent(
AdStageEvent.Click(
params: [
"campaign_id": "SUMMER2025",
"ad_group": "electronics"
]
)
)Standard Event Catalog
The AdStage SDK provides 46 standard events.
📌 Ad Tracking (4)
// 1. 광고 클릭
AdStageManager.shared.trackEvent(
AdStageEvent.Click(
params: ["campaign_id": "CAMP_123"]
)
)
// 2. 광고 노출
AdStageManager.shared.trackEvent(
AdStageEvent.View(
params: ["impression_id": "IMP_456"]
)
)
// 3. 앱 설치
AdStageManager.shared.trackEvent(AdStageEvent.Install())
// 4. 커스텀 이벤트 (event_name으로 이벤트 이름 지정)
AdStageManager.shared.trackEvent(
AdStageEvent.Custom(
params: [
"event_name": "promotion_click",
"promotion_id": "summer_sale_2025"
]
)
)👤 User Lifecycle (5)
// SignUpMethod는 SDK가 제공하는 enum입니다 (직접 정의하지 마세요)
// 사용 가능한 값: .email, .google, .apple, .facebook, .kakao, .naver
// 1. 회원가입 완료
AdStageManager.shared.trackEvent(
AdStageEvent.SignUp(method: .google)
)
// 2. 회원가입 시작
AdStageManager.shared.trackEvent(AdStageEvent.SignUpStart())
// 3. 로그인
AdStageManager.shared.trackEvent(
AdStageEvent.Login(method: .email)
)
// 4. 로그아웃
AdStageManager.shared.trackEvent(AdStageEvent.Logout())
// 5. 앱 최초 실행
AdStageManager.shared.trackEvent(AdStageEvent.FirstOpen())📄 Content View (6)
// 1. 홈 화면
AdStageManager.shared.trackEvent(AdStageEvent.HomeView())
// 2. 상품 목록
AdStageManager.shared.trackEvent(
AdStageEvent.ProductListView(itemCategory: "electronics")
)
// 3. 검색 결과
AdStageManager.shared.trackEvent(
AdStageEvent.SearchResultView(searchTerm: "wireless headphones")
)
// 4. 상품 상세
AdStageManager.shared.trackEvent(
AdStageEvent.ProductDetailsView(
itemId: "PROD_123",
itemName: "Wireless Earbuds"
)
)
// 5. 페이지 조회 (웹)
AdStageManager.shared.trackEvent(
AdStageEvent.PageView(
pageUrl: "https://example.com/products",
pageTitle: "Products"
)
)
// 6. 화면 조회 (앱)
AdStageManager.shared.trackEvent(
AdStageEvent.ScreenView(
screenName: "product_detail",
screenClass: "ProductDetailViewController"
)
)🛒 E-commerce (8)
// 1. 장바구니 추가
AdStageManager.shared.trackEvent(
AdStageEvent.AddToCart(
value: 99000.0,
currency: "KRW",
items: [
EcommerceItem(
itemId: "PROD_123",
itemName: "Wireless Earbuds",
price: 99000.0,
quantity: 1
)
]
)
)
// 2. 장바구니 제거
AdStageManager.shared.trackEvent(
AdStageEvent.RemoveFromCart(
value: 50000.0,
currency: "KRW"
)
)
// 3. 위시리스트 추가
AdStageManager.shared.trackEvent(
AdStageEvent.AddToWishlist(
itemId: "PROD_456",
itemName: "Smart Watch"
)
)
// 4. 결제 정보 입력
AdStageManager.shared.trackEvent(
AdStageEvent.AddPaymentInfo(paymentType: "credit_card")
)
// 5. 결제 시작
AdStageManager.shared.trackEvent(
AdStageEvent.BeginCheckout(
value: 150000.0,
currency: "KRW"
)
)
// 6. 구매 완료 ⭐⭐⭐
AdStageManager.shared.trackEvent(
AdStageEvent.Purchase(
value: 129000.0,
currency: "KRW",
transactionId: "ORDER_20250105_001",
tax: 12900.0,
shipping: 3000.0,
coupon: "SUMMER2025",
items: [
EcommerceItem(
itemId: "PROD_123",
itemName: "Wireless Earbuds",
price: 126000.0,
quantity: 1
)
]
)
)
// 7. 환불
AdStageManager.shared.trackEvent(
AdStageEvent.Refund(
transactionId: "ORDER_20250105_001",
value: 129000.0,
currency: "KRW"
)
)🎮 Progress/Achievement (4)
// 1. 튜토리얼 시작
AdStageManager.shared.trackEvent(
AdStageEvent.TutorialBegin(
params: ["tutorial_id": "intro"]
)
)
// 2. 튜토리얼 완료
AdStageManager.shared.trackEvent(
AdStageEvent.TutorialComplete(
params: ["duration_seconds": 120]
)
)
// 3. 레벨 업
AdStageManager.shared.trackEvent(
AdStageEvent.LevelUp(
level: 25,
character: "warrior"
)
)
// 4. 업적 달성
AdStageManager.shared.trackEvent(
AdStageEvent.Achievement(achievementId: "first_win")
)💬 Interaction (3)
// 1. 검색
AdStageManager.shared.trackEvent(
AdStageEvent.Search(searchTerm: "gaming laptop")
)
// 2. 공유
AdStageManager.shared.trackEvent(
AdStageEvent.Share(
contentType: "product",
method: "kakao"
)
)
// 3. 인앱 광고 클릭
AdStageManager.shared.trackEvent(
AdStageEvent.AdClick(
adPlatform: "admob",
adFormat: "rewarded_video",
adUnitName: "AD_12345"
)
)🎮 Game-Specific (4)
// 1. 게임 플레이
AdStageManager.shared.trackEvent(
AdStageEvent.GamePlay(
level: 10,
levelName: "Dragon's Lair",
character: "mage",
contentType: "dungeon"
)
)
// 2. 보너스 획득
AdStageManager.shared.trackEvent(
AdStageEvent.AcquireBonus(
contentType: "reward",
itemId: "ITEM_123",
itemName: "Gold Chest",
quantity: 1
)
)
// 3. 게임 서버 선택
AdStageManager.shared.trackEvent(
AdStageEvent.SelectGameServer(
contentId: "SERVER_01",
contentType: "pvp",
itemName: "Asia Server"
)
)
// 4. 패치 완료
AdStageManager.shared.trackEvent(
AdStageEvent.CompletePatch(
contentId: "PATCH_2.1.0",
contentType: "update"
)
)📅 Subscription/Trial (3)
// 1. 무료 체험 시작
AdStageManager.shared.trackEvent(
AdStageEvent.StartTrial(
value: 9900.0,
currency: "KRW",
trialDays: 14
)
)
// 2. 구독 시작
AdStageManager.shared.trackEvent(
AdStageEvent.Subscribe(
value: 9900.0,
currency: "KRW",
subscriptionId: "premium_monthly"
)
)
// 3. 구독 취소
AdStageManager.shared.trackEvent(
AdStageEvent.Unsubscribe(subscriptionId: "premium_monthly")
)💰 Virtual Currency (2)
// 1. 가상 화폐(크레딧) 획득 - AcquireBonus 사용
AdStageManager.shared.trackEvent(
AdStageEvent.AcquireBonus(
contentType: "currency",
itemName: "gold",
quantity: 500
)
)
// 2. 가상 화폐(크레딧) 사용 - SpendCredits 사용
AdStageManager.shared.trackEvent(
AdStageEvent.SpendCredits(
value: 100.0,
itemName: "health_potion"
)
)🎯 Other (7)
// 1. 일정 등록
AdStageManager.shared.trackEvent(
AdStageEvent.Schedule(
params: ["event_type": "appointment"]
)
)
// 2. 크레딧 사용
AdStageManager.shared.trackEvent(
AdStageEvent.SpendCredits(
value: 10.0,
itemName: "premium_feature"
)
)
// 3. 프로모션 조회 (Custom 이벤트로 전송)
AdStageManager.shared.trackEvent(
AdStageEvent.Custom(
params: [
"event_name": "view_promotion",
"promotion_id": "PROMO_SUMMER",
"promotion_name": "Summer Sale 2025",
"creative_slot": "home_banner_1"
]
)
)
// 4. 프로모션 선택 (Custom 이벤트로 전송)
AdStageManager.shared.trackEvent(
AdStageEvent.Custom(
params: [
"event_name": "select_promotion",
"promotion_id": "PROMO_SUMMER",
"promotion_name": "Summer Sale 2025"
]
)
)Examples by Event Type
1. App Lifecycle
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
// SDK 초기화
AdStageManager.shared.initialize(
apiKey: "your-api-key",
serverUrl: "https://api.adstage.app"
)
// 첫 실행 이벤트는 SDK가 자동으로 전송
print("✅ 앱 시작")
return true
}
func applicationDidEnterBackground(_ application: UIApplication) {
print("📱 앱 백그라운드 진입")
}
func applicationWillEnterForeground(_ application: UIApplication) {
print("📱 앱 포그라운드 진입")
}
}2. User Authentication
class AuthManager {
// 회원가입
func onSignUpComplete(method: String) {
let signUpMethod: SignUpMethod
switch method {
case "email": signUpMethod = .email
case "google": signUpMethod = .google
case "apple": signUpMethod = .apple
case "kakao": signUpMethod = .kakao
case "naver": signUpMethod = .naver
default: signUpMethod = .email
}
AdStageManager.shared.trackEvent(
AdStageEvent.SignUp(method: signUpMethod)
)
print("✅ 회원가입 완료: \(method)")
}
// 로그인
func onLoginSuccess(userId: String, method: String) {
let loginMethod: SignUpMethod = method == "google" ? .google : .email
AdStageManager.shared.trackEvent(
AdStageEvent.Login(method: loginMethod)
)
print("✅ 로그인: \(userId)")
}
// 로그아웃
func onLogout() {
AdStageManager.shared.trackEvent(AdStageEvent.Logout())
print("🚪 로그아웃")
}
}3. Screen Tracking (BaseViewController Pattern)
class BaseViewController: UIViewController {
// 하위 클래스에서 오버라이드
var screenName: String {
return String(describing: type(of: self))
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
trackScreenView()
}
private func trackScreenView() {
AdStageManager.shared.trackEvent(
AdStageEvent.ScreenView(
screenName: screenName,
screenClass: String(describing: type(of: self))
)
)
print("📺 \(screenName)")
}
}
// 사용 예제
class HomeViewController: BaseViewController {
override var screenName: String { "home" }
}
class ProductDetailViewController: BaseViewController {
override var screenName: String { "product_detail" }
var productId: String?
func loadProduct(_ productId: String) {
self.productId = productId
// 데이터 로딩...
// 상품 상세 조회 이벤트
AdStageManager.shared.trackEvent(
AdStageEvent.ProductDetailsView(
itemId: productId,
itemName: product.name
)
)
}
}4. Full E-commerce Flow
class EcommerceManager {
// 1. 상품 목록 조회
func trackProductList(category: String) {
AdStageManager.shared.trackEvent(
AdStageEvent.ProductListView(itemCategory: category)
)
}
// 2. 검색
func trackSearch(query: String) {
AdStageManager.shared.trackEvent(
AdStageEvent.Search(searchTerm: query)
)
}
// 3. 검색 결과 조회
func trackSearchResults(query: String) {
AdStageManager.shared.trackEvent(
AdStageEvent.SearchResultView(searchTerm: query)
)
}
// 4. 상품 상세 조회
func trackProductView(product: Product) {
AdStageManager.shared.trackEvent(
AdStageEvent.ProductDetailsView(
itemId: product.id,
itemName: product.name
)
)
}
// 5. 장바구니 추가
func trackAddToCart(product: Product, quantity: Int) {
let item = EcommerceItem(
itemId: product.id,
itemName: product.name,
price: product.price,
quantity: quantity
)
AdStageManager.shared.trackEvent(
AdStageEvent.AddToCart(
value: product.price * Double(quantity),
currency: "KRW",
items: [item]
)
)
}
// 6. 위시리스트 추가
func trackAddToWishlist(product: Product) {
AdStageManager.shared.trackEvent(
AdStageEvent.AddToWishlist(
itemId: product.id,
itemName: product.name
)
)
}
// 7. 결제 시작
func trackBeginCheckout(cart: Cart) {
let items = cart.items.map { cartItem in
EcommerceItem(
itemId: cartItem.product.id,
itemName: cartItem.product.name,
price: cartItem.product.price,
quantity: cartItem.quantity
)
}
AdStageManager.shared.trackEvent(
AdStageEvent.BeginCheckout(
value: cart.totalAmount,
currency: "KRW",
items: items
)
)
}
// 8. 결제 정보 입력
func trackAddPaymentInfo(paymentMethod: String) {
AdStageManager.shared.trackEvent(
AdStageEvent.AddPaymentInfo(paymentType: paymentMethod)
)
}
// 9. 구매 완료 ⭐⭐⭐
func trackPurchase(order: Order) {
let items = order.items.map { orderItem in
EcommerceItem(
itemId: orderItem.product.id,
itemName: orderItem.product.name,
price: orderItem.product.price,
quantity: orderItem.quantity
)
}
AdStageManager.shared.trackEvent(
AdStageEvent.Purchase(
value: order.totalAmount,
currency: "KRW",
transactionId: order.id,
tax: order.tax,
shipping: order.shippingFee,
coupon: order.couponCode,
items: items
)
)
print("✅ 구매 완료: \(order.id), \(order.totalAmount)원")
}
// 10. 환불
func trackRefund(order: Order) {
AdStageManager.shared.trackEvent(
AdStageEvent.Refund(
transactionId: order.id,
value: order.totalAmount,
currency: "KRW"
)
)
}
// 11. 공유
func trackShare(product: Product, method: String) {
AdStageManager.shared.trackEvent(
AdStageEvent.Share(
contentType: "product",
method: method
)
)
}
}5. Game Events
class GameEventManager {
// 튜토리얼
func trackTutorialBegin(tutorialId: String) {
AdStageManager.shared.trackEvent(
AdStageEvent.TutorialBegin(
params: ["tutorial_id": tutorialId]
)
)
}
func trackTutorialComplete(tutorialId: String, duration: TimeInterval) {
AdStageManager.shared.trackEvent(
AdStageEvent.TutorialComplete(
params: [
"tutorial_id": tutorialId,
"duration_seconds": Int(duration)
]
)
)
}
// 레벨
func trackLevelUp(level: Int, character: String) {
AdStageManager.shared.trackEvent(
AdStageEvent.LevelUp(
level: level,
character: character
)
)
}
// 업적
func trackAchievement(achievementId: String) {
AdStageManager.shared.trackEvent(
AdStageEvent.Achievement(achievementId: achievementId)
)
}
// 게임 플레이
func trackGameStart(level: Int, levelName: String, character: String) {
AdStageManager.shared.trackEvent(
AdStageEvent.GamePlay(
level: level,
levelName: levelName,
character: character,
contentType: "pvp"
)
)
}
// 보너스 획득
func trackBonusAcquired(itemId: String, itemName: String, quantity: Int) {
AdStageManager.shared.trackEvent(
AdStageEvent.AcquireBonus(
contentType: "reward",
itemId: itemId,
itemName: itemName,
quantity: quantity
)
)
}
// 가상 화폐(크레딧) 획득 - AcquireBonus 사용
func trackEarnCurrency(currencyName: String, amount: Int) {
AdStageManager.shared.trackEvent(
AdStageEvent.AcquireBonus(
contentType: "currency",
itemName: currencyName,
quantity: amount
)
)
}
// 가상 화폐(크레딧) 사용 - SpendCredits 사용
func trackSpendCurrency(currencyName: String, amount: Double, itemName: String) {
AdStageManager.shared.trackEvent(
AdStageEvent.SpendCredits(
value: amount,
itemName: itemName
)
)
}
}Best Practices
1. Using Extensions
// UIViewController+AdStage.swift
extension UIViewController {
func trackScreen() {
let screenName = String(describing: type(of: self))
.replacingOccurrences(of: "ViewController", with: "")
.lowercased()
AdStageManager.shared.trackEvent(
AdStageEvent.ScreenView(
screenName: screenName,
screenClass: String(describing: type(of: self))
)
)
}
}
// 사용
class ProfileViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
trackScreen() // ✅ 간단!
}
}2. Tracking Events in a ViewModel
class ProductViewModel: ObservableObject {
@Published var product: Product?
func loadProduct(productId: String) {
Task {
do {
let product = try await repository.getProduct(productId)
self.product = product
// 상품 조회 이벤트
AdStageManager.shared.trackEvent(
AdStageEvent.ProductDetailsView(
itemId: product.id,
itemName: product.name
)
)
} catch {
print("Failed to load product: \(error)")
}
}
}
func addToCart(product: Product, quantity: Int) {
Task {
do {
try await repository.addToCart(product, quantity: quantity)
let item = EcommerceItem(
itemId: product.id,
itemName: product.name,
price: product.price,
quantity: quantity
)
AdStageManager.shared.trackEvent(
AdStageEvent.AddToCart(
value: product.price * Double(quantity),
currency: "KRW",
items: [item]
)
)
} catch {
print("Failed to add to cart: \(error)")
}
}
}
}3. Using in SwiftUI
import SwiftUI
import AdapterAdStage
struct ProductDetailView: View {
let productId: String
@StateObject private var viewModel = ProductViewModel()
var body: some View {
VStack {
// UI...
Button("장바구니에 추가") {
viewModel.addToCart(viewModel.product, quantity: 1)
// 버튼 클릭 이벤트
AdStageManager.shared.trackEvent(
AdStageEvent.Custom(
params: [
"action": "add_to_cart_button",
"product_id": productId
]
)
)
}
}
.onAppear {
viewModel.loadProduct(productId: productId)
// 화면 조회 이벤트
AdStageManager.shared.trackEvent(
AdStageEvent.ScreenView(
screenName: "product_detail",
screenClass: "ProductDetailView"
)
)
}
}
}4. Event Wrapper Class
class AnalyticsManager {
static let shared = AnalyticsManager()
private init() {}
func trackScreen(_ screenName: String, screenClass: String? = nil) {
AdStageManager.shared.trackEvent(
AdStageEvent.ScreenView(
screenName: screenName,
screenClass: screenClass
)
)
print("📺 Screen: \(screenName)")
}
func trackPurchase(_ order: Order) {
let items = order.items.map {
EcommerceItem(
itemId: $0.product.id,
itemName: $0.product.name,
price: $0.product.price,
quantity: $0.quantity
)
}
AdStageManager.shared.trackEvent(
AdStageEvent.Purchase(
value: order.totalAmount,
currency: "KRW",
transactionId: order.id,
items: items
)
)
print("💰 Purchase: \(order.id)")
}
func trackError(_ error: Error, context: String) {
AdStageManager.shared.trackEvent(
AdStageEvent.Custom(
params: [
"event_type": "error",
"error_message": error.localizedDescription,
"context": context
]
)
)
print("❌ Error: \(context) - \(error)")
}
}5. Performance Optimization: Throttling
class ThrottledEventTracker {
private var lastTrackTimes: [String: TimeInterval] = [:]
private let throttleInterval: TimeInterval = 2.0 // 2초
func trackEvent(_ event: AdStageEventProtocol) {
let eventKey = event.eventName
let now = Date().timeIntervalSince1970
let lastTime = lastTrackTimes[eventKey] ?? 0
if now - lastTime >= throttleInterval {
AdStageManager.shared.trackEvent(event)
lastTrackTimes[eventKey] = now
} else {
print("⏱️ Throttled: \(eventKey)")
}
}
}
// 사용 (스크롤 이벤트 등)
let throttledTracker = ThrottledEventTracker()
func scrollViewDidScroll(_ scrollView: UIScrollView) {
throttledTracker.trackEvent(
AdStageEvent.Custom(
params: [
"action": "scroll",
"offset_y": scrollView.contentOffset.y
]
)
)
}Conversion Example
// 1. 기본 이벤트
// OLD: EventTrackingManager.shared.trackEvent(...)
// NEW:
AdStageManager.shared.trackEvent(AdStageEvent.FirstOpen())
// 2. 로그인
// NEW:
AdStageManager.shared.trackEvent(AdStageEvent.Login(method: .email))
// 3. 화면 조회
// NEW:
AdStageManager.shared.trackEvent(AdStageEvent.ScreenView(screenName: "home"))
// 4. 커스텀
// NEW:
AdStageManager.shared.trackEvent(
AdStageEvent.Custom(params: ["action": "click"])
)Troubleshooting
1. Compile Error: "currency parameter required"
Problem:
// ❌ 에러
AdStageManager.shared.trackEvent(
AdStageEvent.Purchase(value: 9900.0)
)Solution:
// ✅ currency 추가 (ISO 4217, 3자리)
AdStageManager.shared.trackEvent(
AdStageEvent.Purchase(
value: 9900.0,
currency: "KRW"
)
)2. Xcode Autocomplete Not Working
Solution:
- Clean Build Folder:
Product → Clean Build Folder (⇧⌘K) - Delete Derived Data:
~/Library/Developer/Xcode/DerivedData - Reinstall pods:
pod deintegrate
pod install3. Currency Code Validation Error
// ❌ 2자리 코드
AdStageEvent.Purchase(value: 100.0, currency: "KR")
// ValidationException: "Currency must be 3-letter ISO 4217 code"
// ✅ 3자리 ISO 4217 코드
AdStageEvent.Purchase(value: 100.0, currency: "KRW") // 한국 원
AdStageEvent.Purchase(value: 100.0, currency: "USD") // 미국 달러
AdStageEvent.Purchase(value: 100.0, currency: "JPY") // 일본 엔4. SwiftUI Preview Crash
Problem: AdStageManager initialization error in Preview
Solution:
#if DEBUG
struct ProductDetailView_Previews: PreviewProvider {
static var previews: some View {
ProductDetailView(productId: "PROD_123")
.onAppear {
// Preview에서는 초기화하지 않음
if ProcessInfo.processInfo.environment["XCODE_RUNNING_FOR_PREVIEWS"] == nil {
AdStageManager.shared.initialize(
apiKey: "test-key",
serverUrl: "https://api.adstage.app"
)
}
}
}
}
#endif5. Checking Debug Logs
The SDK automatically prints logs of the initialization and event-sending process to the console. You can check them directly in the Xcode console without any separate debug mode setup.
Console filter:
# Xcode Console
filter: AdStage (또는 ADSTAGE)References
Standard References
FAQ
Q: How do I send a custom event?
A: Use AdStageEvent.Custom(params: [...])
Q: Is it compatible with the Android SDK?
A: Yes, v3.0 supports the same 46 events as the Android SDK, 100% identical.
Q: Can I use it in SwiftUI?
A: Yes, it is fully supported through the ObservableObject pattern.
Support
Contact:
- Email: support@nbase.io
© 2025 NBase. All rights reserved.

