Closed KillianZimmer closed 3 months ago
Hi @KillianZimmer -
The sample code you've provided is working for me with 1.5.2, with a few minor fixes:
flush()
(Events should still be recorded, but it may take an extended amount of time before we upload them)class ViewModel {
private let amplitude = Amplitude(
configuration: Configuration(
apiKey: "", // Replace with your API key
instanceName: "" // Replace with your Instance name,
optOut: false,
trackingOptions: TrackingOptions().disableTrackDMA(),
enableCoppaControl: false,
defaultTracking: DefaultTrackingOptions(
sessions: true
)
)
)
init() {
amplitude.track(eventType: "app_opened")
}
}
struct ContentView: View {
let viewModel = ViewModel()
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
}
.padding()
}
}
#Preview {
ContentView()
}
Please let me know if you are still seeing issues.
Hi @crleona sorry I went to quickly when sending the project. I'll still try to find what's wrong with my actual project and why events are not tracked when I just update the Amplitude SPM version. Thanks.
Hi again @crleona I made a sample project that is more like my actual one, with an extension-based watchOS app. The Amplitude SDK is tracking event only using the Apple Watch simulator. I don't see any event on the Amplitude web platform when running on an actual Apple Watch device. I have to switch to the v1.1.0 to make it works.
One more thing, everything is working great on iPhone :)
Hi @KillianZimmer, your sample app is also working for me on Xcode 15.4 / WatchOS 10.5 - is there a particular version you're using that doesn't work?
One thing to note is versions subsequent to 1.1.0 contain a data migration, and we may use a prior session when switching back and forth from a newer version. If you're using the user look-up page to view events, this may mean that newer events are added below the latest session, as the page is sorted chronologically by session, not event.
Hi @crleona, I'm using the same versions as you, tested on : • Xcode 15.4 / Command Line Tools 15.4 / Apple Watch series 8 41mm / WatchOS 10.5 • Xcode 15.2 / Command Line Tools 15.2 / Apple Watch series 8 41mm / WatchOS 10.5 • Xcode 15.4 / Command Line Tools 15.2 / Apple Watch series 8 41mm / WatchOS 10.5 • Xcode 15.4 / Command Line Tools 15.4 / Apple Watch Ultra / WatchOS 10.5 • Xcode 15.4 / Command Line Tools 15.4 / Apple Watch series 9 45mm / WatchOS 10.5
Even starting from a fresh install with a new project with new bundle identifier using only the SDK 1.5.2, I don't see any event on Amplitude.
Hi @KillianZimmer - the key was running this on a real device, not a simulator. This should be resolved as of 1.6.0.
Summary
I'm struggling implementing the SDK on watchOS app. Tracking event is working as expected with version
1.1.0
only. The1.2.0
and above versions do not work anymore, I cannot see any event logged on the Amplitude web interface. Either with extension-based apps running in watchOS or with single watchOS app target.Here is a sample project example: Amplitude-Watch-Test.zip