iOS SDK - SDK 초기화
다음 코드는 트래커와 SDK를 설치하여 모든 트래커 기능을 활용할 수 있게 해 줍니다.
Cocoapods
Section titled Cocoapods pod 'OpenReplay', '~> 1.0.17'
Swift Package Manager
Section titled Swift Package Managerdependencies: [
.package(url: "https://github.com/openreplay/ios-tracker.git", from: "1.0.17"),
]
OpenReplay의 트래커를 인스턴스화할 때 다양한 설정 옵션을 지정하여 녹화와 녹화 환경의 여러 측면을 사용자 지정할 수 있습니다. 생성자에서 projectKey 옵션을 반드시 설정해야 합니다. 이 값은 OpenReplay 대시보드의 ‘Preferences > Projects’에서 확인할 수 있습니다.
트래킹 코드 추가
Section titled 트래킹 코드 추가AppDelegate.swift 파일에 다음 코드를 추가합니다.
// AppDelegate.swift
import OpenReplay
//...
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// not required if you're using our SaaS version
OpenReplay.shared.serverURL = "https://your.instance.com/ingest"
// check out our SDK docs to see available options
OpenReplay.shared.start(projectKey: "projectkey", options: .defaults)
// ...
return true
}
터치 리스너 설정
Section titled 터치 리스너 설정// SceneDelegate.Swift
import OpenReplay
// ...
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
let contentView = ContentView()
.environmentObject(TodoStore())
if let windowScene = scene as? UIWindowScene {
let window = TouchTrackingWindow(windowScene: windowScene) // <<<< here
window.rootViewController = UIHostingController(rootView: contentView)
self.window = window
window.makeKeyAndVisible()
}
}
데이터 정제
Section titled 데이터 정제자세한 내용은 iOS 리플레이에서 데이터를 정제하는 방법을 참조하세요.
초기화 옵션
Section titled 초기화 옵션crashes: Bool크래시 분석(crashlytics)을 활성화합니다.analytics: Bool표시된 뷰의 분석 추적을 활성화합니다.performances: Bool성능 리스너를 활성화합니다.logs: Bool로그 리스너를 활성화합니다.screen: Bool화면 녹화기를 활성화합니다.wifiOnly: Bool사용자가 Wi-Fi에 연결된 경우에만 트래커가 시작되도록 합니다.isBlur: Bool민감한 뷰를 블러 처리하거나(true) 단색 상자로 가립니다(false). 기본값은true입니다.
질문이 있으신가요?
Section titled 질문이 있으신가요?이 과정에 대해 궁금한 점이 있으면 언제든지 Slack으로 문의해 주세요.