amplitude / Amplitude-Swift

Native iOS/tvOS/macOS/watchOS SDK
MIT License
26 stars 20 forks source link

Crash of the 1.6.0 on WatchOS 8 #178

Closed djavan-bertrand closed 3 months ago

djavan-bertrand commented 3 months ago

The SDK 1.6.0 crashes on watchOS 8. The crash occurs at app startup:

dyld[87977]: Symbol not found: _$sSo13WKApplicationC8WatchKitE30didEnterBackgroundNotificationSo18NSNotificationNameavgZ
  Referenced from: /Users/djavan.bertrand/Library/Developer/CoreSimulator/Devices/E858B752-0788-40E6-9BD4-F16B5FF6579B/data/Containers/Bundle/Application/7BE69845-5B5D-4047-A6EB-18D887720C21/Watch-App-Sampler WatchKit App.app/PlugIns/Watch-App-Sampler WatchKit Extension.appex/Watch-App-Sampler WatchKit Extension
  Expected in: /Library/Developer/CoreSimulator/Profiles/Runtimes/watchOS 8.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/libswiftWatchKit.dylib

Please note that it does not crash with the 1.5.2.

Possible Solution

I don't have a solution, but this might be related to the changes brought in this PR: https://github.com/amplitude/Amplitude-Swift/pull/163 Maybe using compiler directive or availability directives (something like if #available(watchOS 8.0, *) would solve this crash?

Steps to Reproduce

Please use the following sample project (it is just a watch OS app with a dependency on Amplitude-Swift 1.6.0): Amplitude-Watch-Test.zip

  1. Run it on a watchOS 8 simulator or real device

Environment

thedavidharris commented 3 months ago

Oof, apparently this is... a mess. https://github.com/RevenueCat/purchases-ios/pull/1895 I think has an example for how to fix this.

Will likely not get a chance tomorrow but can probably PR this before the end of the week. Sorry for the confusion here.

crleona commented 3 months ago

HI @djavan-bertrand, @thedavidharris - I have a patch which should resolve this issue and another issue tracking sessions on watchOS.

djavan-bertrand commented 3 months ago

@crleona Hi, thanks for this quick work. I've tried the patch on devices (simulator and real devices) and it seems to work. 💪

crleona commented 3 months ago

This should be released in 1.6.1. @thedavidharris @djavan-bertrand thank you for your help!