client-sdk-swift icon indicating copy to clipboard operation
client-sdk-swift copied to clipboard

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

Open wzJun1 opened this issue 1 year ago • 7 comments

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

wzJun1 avatar Jun 27 '24 04:06 wzJun1

  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?

hiroshihorie avatar Jun 27 '24 05:06 hiroshihorie

  1. Xcode 15.4 and Swift 5.10
  2. Swift
  3. Yes

wzJun1 avatar Jun 27 '24 06:06 wzJun1

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

wzJun1 avatar Jun 27 '24 06:06 wzJun1

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

hiroshihorie avatar Jun 27 '24 09:06 hiroshihorie

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

wzJun1 avatar Jun 27 '24 09:06 wzJun1

Hmm looks like some Xcode bug, I'm not sure how to reproduce this at the moment.

hiroshihorie avatar Jul 05 '24 17:07 hiroshihorie

Okay, then I will continue to follow up

wzJun1 avatar Jul 06 '24 09:07 wzJun1