livekit / client-sdk-swift

LiveKit Swift Client SDK. Easily build live audio or video experiences into your mobile app, game or website.
https://livekit.io
Apache License 2.0
173 stars 84 forks source link

After pulling the source code locally, some Delegates will report errors #414

Open wzJun1 opened 1 week ago

wzJun1 commented 1 week ago

Describe the bug After pulling the source code locally, some Delegates will report errors

SDK Version 2.0.10 ~ 2.0.11

iOS/macOS Version iOS17.2

Steps to Reproduce

No need for Swift Package Manager, simply pull the source code locally

  1. Connect Room
  2. Open Camera
  3. Crash

If I remove @objc, it will work normally. (or do I just use newValue?.delegates.add(delegate: self) It also works (but the entire livekit sdk has too many delegates, it is too troublesome to change them all)

I feel like it's a problem with the Swift version being too high, but I don't know how to solve it.

Screenshots 171719461830_ pic

iShot_2024-06-27_12 17 30
hiroshihorie commented 1 week ago
  1. Can you tell me your Xcode version?
  2. Are you using the SDK with Objective-C or Swift?
  3. Is it reproducible for you?
wzJun1 commented 1 week ago
  1. Xcode 15.4 and Swift 5.10
  2. Swift
  3. Yes
wzJun1 commented 1 week ago

My current solution is to no longer use add and remove with @objc, but instead use xxx.delegates.add() directly.

eg:

iShot_2024-06-27_14 55 59 iShot_2024-06-27_14 56 07
hiroshihorie commented 1 week ago

Hmm.. It's odd that you need to do that, is it only with TrackDelegate ?

wzJun1 commented 1 week ago

Not only 'TrackDelegate', but all delegate add remove with @objc, as shown in the screenshot below, are like this.

iShot_2024-06-27_17 50 57 iShot_2024-06-27_17 52 21