草庐IT

ambiguity

全部标签

ios - Swift:尝试将元组传递给回调函数时获取 "ambiguous expression"

我有这个类用于根据我的后端对用户进行身份验证。classBackendService{classfuncperformLogin(#email:String,password:String,success:((res:NSHTTPURLResponse,json:JSON,statusCode:HTTPStatus))->(),failure:(NSError)->()){letloginURL=baseURL+"/login"letparameters=["email":email,"password":password]Alamofire.request(.POST,loginUR

ios - Swift:尝试将元组传递给回调函数时获取 "ambiguous expression"

我有这个类用于根据我的后端对用户进行身份验证。classBackendService{classfuncperformLogin(#email:String,password:String,success:((res:NSHTTPURLResponse,json:JSON,statusCode:HTTPStatus))->(),failure:(NSError)->()){letloginURL=baseURL+"/login"letparameters=["email":email,"password":password]Alamofire.request(.POST,loginUR

swift - "Ambiguous use of ' propertyName '"错误给出了 didSet 观察者覆盖的属性

我有一个简单的场景,其中我有一个父类Person,它定义了一个名为“name”的属性并包含一个“didSet”观察者...classPerson{varname:String?{didSet{println("Personnamewasset.")}}init(){}}我还有一个名为Employee的Person子类,它为“name”属性添加了自己的“didSet”观察器,以便它可以监视对该属性的更改...classEmployee:Person{overridevarname:String?{didSet{println("Employeenamewasset.")}}}当我尝试运行

swift - "Ambiguous use of ' propertyName '"错误给出了 didSet 观察者覆盖的属性

我有一个简单的场景,其中我有一个父类Person,它定义了一个名为“name”的属性并包含一个“didSet”观察者...classPerson{varname:String?{didSet{println("Personnamewasset.")}}init(){}}我还有一个名为Employee的Person子类,它为“name”属性添加了自己的“didSet”观察器,以便它可以监视对该属性的更改...classEmployee:Person{overridevarname:String?{didSet{println("Employeenamewasset.")}}}当我尝试运行

swift 错误 : Ambiguous reference to member 'subscript'

我是编码新手,选择了一些开源项目来了解这个想法。我收到错误:Ambiguousreferencetomember'subscript'在下面的代码中:letpictures=(selectedRestaurant["Pictures"]as!NSArray)//Errorletpicture=(pictures[zoomedPhotoIndex]as!NSDictionary)letpictureURL=picture["url"]as!StringletimageURL=NSURL(string:pictureURL)leturlRequest=NSURLRequest(URL:im

swift 错误 : Ambiguous reference to member 'subscript'

我是编码新手,选择了一些开源项目来了解这个想法。我收到错误:Ambiguousreferencetomember'subscript'在下面的代码中:letpictures=(selectedRestaurant["Pictures"]as!NSArray)//Errorletpicture=(pictures[zoomedPhotoIndex]as!NSDictionary)letpictureURL=picture["url"]as!StringletimageURL=NSURL(string:pictureURL)leturlRequest=NSURLRequest(URL:im

swift - 如何使用 Swift #selector 语法解决 "ambiguous use of"编译错误?

[注意这个问题最初是在Swift2.2下制定的。它已针对Swift4进行了修订,涉及两个重要的语言更改:第一个方法参数external不再自动抑制,并且选择器必须显式暴露给Objective-C。]假设我的类(class)中有这两种方法:@objcfunctest(){}@objcfunctest(_sender:AnyObject?){}现在我想使用Swift2.2的新#selector使选择器对应于这些方法中的第一个的语法,functest().我该怎么做?当我尝试这个时:letselector=#selector(test)//error...我收到一个错误,“test()的用法

swift - 如何使用 Swift #selector 语法解决 "ambiguous use of"编译错误?

[注意这个问题最初是在Swift2.2下制定的。它已针对Swift4进行了修订,涉及两个重要的语言更改:第一个方法参数external不再自动抑制,并且选择器必须显式暴露给Objective-C。]假设我的类(class)中有这两种方法:@objcfunctest(){}@objcfunctest(_sender:AnyObject?){}现在我想使用Swift2.2的新#selector使选择器对应于这些方法中的第一个的语法,functest().我该怎么做?当我尝试这个时:letselector=#selector(test)//error...我收到一个错误,“test()的用法

C#接口(interface)方法歧义

考虑以下示例:interfaceIBase1{intPercentage{get;set;}}interfaceIBase2{intPercentage{get;set;}}interfaceIAllYourBase:IBase1,IBase2{}classAllYourBase:IAllYourBase{intpercentage;intPercentage{get{returnpercentage;}set{percentage=value;}}}voidFoo(){IAllYourBaseiayb=newAllYourBase();intpercentage=iayb.Perce

C#接口(interface)方法歧义

考虑以下示例:interfaceIBase1{intPercentage{get;set;}}interfaceIBase2{intPercentage{get;set;}}interfaceIAllYourBase:IBase1,IBase2{}classAllYourBase:IAllYourBase{intpercentage;intPercentage{get{returnpercentage;}set{percentage=value;}}}voidFoo(){IAllYourBaseiayb=newAllYourBase();intpercentage=iayb.Perce