草庐IT

Ambiguous

全部标签

ios - 为什么在使用@available实现回退时Xcode显示 "Ambiguous use of ' myMethod'?

在为使用@available(iOS8.0,*)的方法实现后备实例方法时,Xcode显示一个构建错误:“‘myMethod’的使用不明确...以及突出显示的两个候选方法。尽管使用了@available指令。例如:@available(iOS8.0,*)funcgetURLParameter()->NSURLQueryItem{returnNSURLQueryItem(name:"name",value:"John")}funcgetURLParameter()->Dictionary{return["name":"John"]}letparam=getURLParameter()@av

ios - "Ambiguous use of ' 下标 '"不知从何而来

这个问题在这里已经有了答案:Ambiguoususeofsubscriptxcode7.1(2个答案)关闭6年前。有很多关于这个错误的问题,但我还没有找到任何相关的东西。我编译并运行了我的项目很多次,一切都很好,然后突然间,Xcode突然莫名其妙地开始在这一行显示以下错误:ifletuserId=jsonresult["user_id"]{...}我正在使用SwiftyJSON。我很困惑,因为这个错误以前不在这里。我没有更改此类中的任何内容,我什至检查了应用程序启动并运行的上一次提交,现在错误也在那里。我尝试清理项目并删除派生数据,但它什么也没做。

ios - 初始化 CBCentralManager : Type of expression is ambiguous without more context

尝试在Swift4.2项目中初始化CBCentralManager。获取评论中显示的错误:importCoreBluetoothclassSomeClass:NSObject,CBCentralManagerDelegate{//Typeofexpressionisambiguouswithoutmorecontextletmanager:CBCentralManager=CBCentralManager(delegate:self,queue:nil)//MARK:-Functions:CBCentralManagerDelegatefunccentralManagerDidUpda

ios - 不清楚的 "Type of expression is ambiguous without more context"错误

几个月后我回到我的旧XCode项目,现在我有很多以前没有的错误,我假设这与更新的语法有关。为什么我会看到:Typeofexpressionisambiguouswithoutmorecontext对于这个block@IBActionfuncsubmitUrl(sender:UIButton){varapp=UIApplication.sharedApplication().delegateas!AppDelegate//ErroroccursinbelowdeclarationofstudentDictvarstudentDict=["latitude":self.latitude,"

swift - "Type of expression is ambiguous without more context"多维数组错误

我正在尝试创建一个数组,该数组最好以这种格式存储对象[[[String,CGPoint,Bool]]],但是到处都是错误,所以我决定将其设置为[[[AnyObject]]]。这是我声明数组的代码:varsavePlayerState:[[[AnyObject]]]=[]如您所见,它是一个多维数组,我需要在其中存储3个内容:当前时间、玩家位置和一个简单的Bool。以下是我尝试将数据保存到数组的方式:savePlayerState.append([timeLabel.text,player.position,isPlayerAlive])我的错误是:Typeofexpressionisam

ios - 如何解决 "Type of expression in ambiguous without more context"?

letattributedString=NSAttributedString(data:encodedData,options:attributedOptions,documentAttributes:nil,error:nil)!编译器错误:“表达式类型不明确,没有更多上下文”怎么解决的? 最佳答案 要求[String:AnyObject]attributedOptions参数要求的格式do{letencodedData=yourEncodedString.dataUsingEncoding(NSUTF8StringEncodin

swift - "Type of expression is ambiguous without more context"尝试创建新变量以附加数组时

我是编码和Swift的新手,现在正在尝试创建一个小型应用程序。我创建了这部分代码:overridefunctableView(tableView:UITableView,didSelectRowAtIndexPathindexPath:NSIndexPath){tableView.deselectRowAtIndexPath(indexPath,animated:true)letcell=tableView.cellForRowAtIndexPath(indexPath)varselectedSubject=toBeAddedSubjects[indexPath.row]asSubje

ios - Alamofire 4.0.0 : [String:String] is not convertible to [String : Any] & Request is ambiguous without more context

我正在将Alamofire更新到4.0.0Beta1并将XCode8更新到Beta6。首先,我得到了[String:String]isnotconvertibleto[String:Any]错误代码letparameter=["scope":"\(scope)","client":"\(clientId)"]Alamofire.request(link,withMethod:.POST,parameters:parameter,encoding:.json).responseJSON在我更改后将[String:Any]添加到参数中,错误消失但产生了新错误:Expressiontype'

ios - Swift 中的 Facebook 登录管理器 "expression is ambiguous"错误

我正在尝试使用Swift构建IOS游戏,但在添加自定义Facebook登录按钮时遇到了问题。我在touchesEnded函数中有以下代码:letloginManager=LoginManager()loginManager.logIn([.PublicProfile],viewController:self){loginResultinswitchloginResult{case.Failed(leterror):print(error)case.Cancelled:print("Usercancelledlogin.")case.Success(letgrantedPermissio

ios - "Ambiguous reference to member map"来自具体类型

这是我的代码。它使用来自CoreBluetooth的CBUUID。让我们假设v的转换是有效的。importUIKitimportCoreBluetoothfuncconvert(v:AnyObject)->[String:String]{return(vas![CBUUID:NSData]).map{(uuid,data)in(uuid.UUIDString,NSString(data:data,encoding:NSUTF8StringEncoding)??"")}}想法是通过为CBUUID调用CBUUID.UUIDString并通过调用适当的NSString构造函数来获取字典的字符