草庐IT

invoke-expression

全部标签

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

ios - swift fatal error : 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=3840 "Garbage at end."

我的swift程序一直有这个错误,我正在使用PHP和MySQL作为数据库。我要将数据从数据库显示到TableView。之前是可以的,但是在模拟器上运行了几次之后,我一直遇到同样的错误classHome:UIViewController,UITableViewDelegate,UITableViewDataSource{@IBOutletweakvarbtnaddclass:UIButton!@IBOutletvartableView:UITableView!varvalues:NSArray=[]funcget(){leturl=NSURL(string:"http://localho

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

javascript - 在 Https 上使用 Express.js 在 Node.js 上配置 ATS

我有一个node.js服务器,它必须从使用express管理路由器的node.js应用程序接收json调用,iOS应用程序调用路由器传递json值。我还补充说,如果我在http中工作,我没有任何问题!我的问题是我无法配置苹果ATS。我该怎么办?下面我输入了Info.plist相关的代码和信息。错误:ATSDefaultConnection2018-05-1808:54:14.070nscurl[7310:57407]NSURLSession/NSURLConnectionHTTPloadfailed(kCFStreamErrorDomainSSL,-9802)Result:FAIL--

ios - 为什么我会收到此错误 : Result values in '? :' expression have mismatching types '[String]?' and 'String'

所以我是swift的新手,我正在尝试使用谷歌地图。我无法弄清楚为什么这条线有效:让state=p?.administrativeArea!=nil?p?.administrativeArea:"nil6"但不是这一行:让areaOfInterest=p?.areasOfInterest!=nil?p?.areasOfInterest:"nil7"我在areaOfInterest行收到此错误消息:'?中的结果值:'表达式有不匹配的类型'[String]?'和“字符串”提前致谢。CLGeocoder().reverseGeocodeLocation(userLocation){(place

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

swift - 整数类型 : Cannot invoke 'init' with an argument of type 'T'

我有一个返回范围内整数的函数:funcrandomNumber(min:T,max:T)->T{letn=max-min+1letu=UInt32(n)//Error:Cannotinvoke'init'withanargumentoftype'T'letr=arc4random_uniform(u)returnr+min}我不明白为什么这不起作用,因为UInt32最上面的协议(protocol)是UnsignedIntegerType,它符合IntegerType。我必须将n变成UInt32因为arc4random_uniform()需要一个UInt32作为参数为什么这行不通?

ios - 无法使用 Google Places API 获取地点的详细信息 - "Cannot invoke ' lookUpPlaceID' "

我正在尝试使用适用于iOS的GooglePlacesAPI获取有关地点的详细信息。尝试调用lookUpPlaceID函数时,收到以下Swift编译器错误:Cannotinvoke'lookUpPlaceID'withanargumentlistoftype'(String,callback:(GMSPlace!,_)->Void)'letplaceID="ChIJV4k8_9UodTERU5KXbkYpSYs"placesClient!.lookUpPlaceID(placeID,callback:{(place:GMSPlace!,error)->Voidiniferror!=nil

ios - 核心数据错误 : Unsupported expression type (11, SIZE)

当我尝试创建以下NSPredicate时发生错误:letpredicate=NSPredicate(format:"size=nil")错误如下:Unsupportedexpressiontype(11,SIZE) 最佳答案 这是因为size是CoreData中的保留字。这可以像这样修复:letpredicate=NSPredicate(format:"#size=nil") 关于ios-核心数据错误:Unsupportedexpressiontype(11,SIZE),我们在Stack

Swift 2.0 : Cannot invoke with an argument list of type. ..(HTTP 请求)

自从我升级到Xcode7beta后,我遇到了一个无法修复的错误。这是我的DataManager.swift中的完整代码importFoundationvarTopAppURL:String=String()varnumberAsked:String=String()classDataManager{classfuncgetInfo(ID:String){TopAppURL="http://sweetapi.com/?=\(ID)"numberAsked=ID}classfuncloadDataFromURL(url:NSURL,completion:(data:NSData?,erro