-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathmain.swift
More file actions
43 lines (33 loc) · 1.12 KB
/
main.swift
File metadata and controls
43 lines (33 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// main.swift
// IntegrationTests
//
// Created by Denis Chilik on 11/4/25.
//
import Foundation
import mParticle_Apple_SDK
var options = MParticleOptions(
key: "", // Put your key
secret: "" // Put your secret
)
var identityRequest = MPIdentityApiRequest.withEmptyUser()
identityRequest.email = "foo@example.com";
identityRequest.customerId = "123456";
options.identifyRequest = identityRequest;
options.onIdentifyComplete = { apiResult, error in
if let apiResult {
apiResult.user.setUserAttribute("example attribute key", value: "example attribute value")
}
}
options.logLevel = .verbose
var networkOptions = MPNetworkOptions()
networkOptions.configHost = "127.0.0.1"; // config2.mparticle.com
networkOptions.eventsHost = "127.0.0.1"; // nativesdks.mparticle.com
networkOptions.identityHost = "127.0.0.1"; // identity.mparticle.com
networkOptions.pinningDisabled = true;
options.networkOptions = networkOptions;
let mparticle = MParticle.sharedInstance()
mparticle.start(with: options)
sleep(1)
mparticle.logEvent("Simple Event Name", eventType: .other, eventInfo: ["SimpleKey": "SimpleValue"])
sleep(7)