草庐IT

EXPECT_CALL

全部标签

ios - swift 3 : reverseGeocodeLocation does not call its completion handler

这是我的代码ifloc.latitude!=0.0&&loc.longitude!=0.0{letloca=CLLocation(latitude:loc.latitude,longitude:loc.longitude)geoCoder.reverseGeocodeLocation(loca){(placemarks,error)in//thisisthelastlinethatisbeingcalledvarplacemark:CLPlacemark!placemark=placemarks?[0]city=(placemark.addressDictionary?["City"]

ios - 核心数据 : error: Failed to call designated initializer on NSManagedObject class

我做了一些研究,我真的不明白这里发生了什么。当我在TableView中选择一行时出现此错误:Wish[1392:37721]CoreData:错误:无法调用NSManagedObject类“Wish.ProduitEntity”上的指定初始值设定项(lldb)错误出在ViewController类中的prepareForSegue方法上。感谢帮助importUIKitimportCoreDataclassViewController:UIViewController,UITableViewDataSource,UITableViewDelegate{@IBOutletweakvarle

ios - swift 2.0 : `print` function generates "Argument passed to call that takes no arguments" error

类中的print函数神秘地生成以下错误:Argumentpassedtocallthattakesnoarguments。但是,如果我们使用Swift.print而不是仅仅使用print来调用函数,错误就会消失。我们使用的是Swift2和Xcode7。为什么会这样?在生成错误的地方测试下面的函数:functest(){print("whydoesthisfail")} 最佳答案 However,theerrorgoesawayifweuseSwift.printinsteadofjustprinttoinvokethefunctio

ios - 错误 "Call can throw, but is not marked with ' try' 错误未被处理”

这段代码出错“调用可以抛出,但没有标上‘try’,错误未被处理”我正在使用Xcode7.1最新的beta和swift2.0funccheckUserCredentials()->Bool{PFUser.logInWithUsername(userName!,password:password!)if(PFUser.currentUser()!=nil){returntrue}returnfalse 最佳答案 Swift2.0引入了errorhandling.该错误表明logInWithUsername:password:可能会引发错

swift 4 "Extra argument in call"Rxswift

我从Swift3更新到4,我正在使用RxSwift,更新后我遇到了一个错误“调用中的额外参数”,因为它现在期望类型元素。我尝试创建(响应,数据)的元组,但仍然给我一个错误,如图所示。publicstaticfuncdeleteCrush(receiver:String,receiver_type:ProviderType)->Observable{/*Deletecrushidentifiedby`id`*/letparameters:Parameters=["receiver":receiver,"receiver_type":receiver_type.rawValue]print

ios - swift 警告 : Application delegate received call to -application:performFetchWithCompletionHandler: but the completion handler was never called

我在下面的模拟器中调用这个函数来模拟后台获取。然后我在日志中收到这个警告:SwiftWarning:Applicationdelegatereceivedcallto-application:performFetchWithCompletionHandler:butthecompletionhandlerwasnevercalled.我看到其他StackIverflow回答说我只需要添加completionhandler()。我试过了,它说我需要添加一个参数,这就是我迷路的地方。funcapplication(_application:UIApplication,performFetc

swift - Xcode 10.1 swift 4.2 运算符重载导致编译器警告 : "All paths through this function will call itself"

所以我突然收到这个编译器警告,它在swift3或(我认为)swift4.0上不存在。下面的代码重载+=运算符以执行向量增量:publicfunc+=(left:inoutCGVector,right:CGVector){left+=right}并产生警告,我很困惑任何人都可以阐明为什么会发出警告以及出了什么问题吗? 最佳答案 当您执行left+=right时,它会调用您定义的同一函数。换句话说,您的运算符重载函数+=(左:inoutCGVector,右:CGVector)将始终调用自身(无限递归)。你正在做类似的事情funcfoo(

swift - 苹果操作系统 : is there any way to sniff system open call without kernel

我必须从MacOS中的任何位置打开一个文件,并且我想在它在任何相关应用程序中打开之前执行一些操作。有什么办法可以嗅探系统opencall并保持一段时间,然后进行一些操作。例如,我正在打开test.doc文件,它将在msword应用程序中打开,或者可以通过右键单击并选择任何其他应用程序打开。在我的text.doc文件上启动此msword应用程序或任何相关应用程序(系统打开调用)之前,我想等待并执行一些操作。MacOS(C/C++/ObjectiveC/Swift)的编程语言有没有办法不用进入内核?任何帮助将不胜感激。 最佳答案 据我所

ios - Swift 2.2 语法错误 : Cannot call value of non-function type 'UITableView!'

我在UITableView单元格中使用Tab手势,但出现以下错误。“无法调用非函数类型‘UITableView!’的值!”我正在使用从我以前的ObjectiveC项目继承的以下代码:varp:CGPoint=sender.locationInView(self.tableView)varindexPath:NSIndexPath=self.tableView(forRowAtPoint:p)varbuttonTag:Int=indexPath.rowvarselectView=self.storyboard?.instantiateViewControllerWithIdentifie

objective-c - Swift 中的 block 显示错误 "Missing argument for parameter #2 in call"

关闭。这个问题是notreproducibleorwascausedbytypos.它目前不接受答案。这个问题是由于错别字或无法再重现的问题引起的。虽然类似的问题可能是on-topic在这里,这个问题的解决方式不太可能帮助future的读者。关闭7年前。Improvethisquestion我现在正在使用JonasGessner的JGActionSheet在我的项目中使用Swift,示例是由Objective-C编写的,当我尝试将block转换为Swift时,Xcode显示错误“调用中参数#2缺少参数”,这是我编写的代码和屏幕截图:Objective-C示例JGActionSheet*