'Method' is ambiguous for type lookup in this context, Error in Alamofire

后端 未结 11 1474
灰色年华
灰色年华 2020-12-20 10:52

I am using Alamofire for network handling in swift and run into one weird error. It seems like we can\'t pass Method enum as parameter.
[Error is on Method para

相关标签:
11条回答
  • 2020-12-20 11:31

    While the answer to this did fix the build error; in my case, the file showing the warning was in two different frameworks so Xcode did not know where to look. This was not the intended behavior of our internal frameworks so I simply removed the copy I no longer wanted.

    0 讨论(0)
  • 2020-12-20 11:32

    Swift 4 and Alamofire 4.7

    Replace HTTPMethod to Alamofire.HTTPMethod

    0 讨论(0)
  • 2020-12-20 11:34

    I got this error because my database table name and model class name was same...Issue resolved by renaming model class name.

    0 讨论(0)
  • 2020-12-20 11:35

    I have also encountered this problem, because I have declared a number of the same name of the protocol:

    protocol SomeProtocol {
       static func someTypeMethod()
    }
    
    protocol SomeProtocol {
       init(someParameter: Int)
    }
    
    protocol SomeProtocol {
       var mustBeSettable: Int { get set }
       var doesNotNeedToBeSettable: Int { get }
    }
    
    0 讨论(0)
  • 2020-12-20 11:37

    The type Method is declared in two imported modules. You have to specify the module from which to use the type. Use Alamofire.Method instead of Method.

    Tip: If you are using the type often, you can create a type alias in your module (application):

    typealias Method = Alamofire.Method
    

    That way you will not need to prefix the type with Alamofire. any more.

    0 讨论(0)
提交回复
热议问题