matrix-org / matrix-org/matrix-ios-sdk

[Bug] "ambiguous use of" error for functions

Open
#1,097 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Objective-C
Stars
484
Forks
225
PR merge metrics
No merged PRs in 30d

Description

Was trying to run the swift examples from the README and I keep getting the following error

error: MatrixSDK.playground:10:1: error: ambiguous use of 'start(withSyncFilterId:completion:)'
session.start { response in
^

MatrixSDK.MXSession:2:26: note: found this candidate
    @nonobjc public func start(withSyncFilterId filterId: String? = nil, completion: @escaping (MatrixSDK.MXResponse<Void>) -> Void)
                         ^

/Users/focks/Documents/Xcode Projects/Pill/Pods/MatrixSDK/MatrixSDK/Contrib/Swift/MXSession.swift:34:19: note: found this candidate
    @nonobjc func start(withSyncFilterId filterId: String? = nil, completion: @escaping (_ response: MXResponse<Void>) -> Void) {
                  ^

To Reproduce
Steps to reproduce the behavior:

  1. Follow swift CocoaPods install instructions
  2. try running the code for Example 2 where you fetch rooms a user has been in
  3. See error

Expected behavior
the code to work and fetch the list of rooms

Desktop (please complete the following information):

  • OS: macOS
  • Version: 11.3
  • Swift Version: 5.4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the ambiguity by following the Swift CocoaPods instructions and running README Example 2. Start with Contrib/Swift/MXSession.swift and compare the two start(withSyncFilterId:completion:) candidates shown by the compiler. Done means the example compiles and fetches the user's rooms without the ambiguous-use error.

Written by the indexing model from the issue text.

Assessment

Tech stack
objective-c, swift
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.