草庐IT

Invoke-Command

全部标签

Swift 编译器错误 : Command failed due to signal: Segmentation fault: 11

我是Xcode和swift的新手,但我已经能够将错误源缩小到这行代码。我到处搜索但找不到解决方案。我目前正在使用Xcode8.1。button.addTarget(self,action:#selector(handleRegister),for:.touchUpInside)这是我的一些代码importUIKitclassLoginController:UIViewController{letbackGroundImageView:UIImageView={letimageView=UIImageView()imageView.image=UIImage(named:"backgrd

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

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

ios - 在 Swift 数组上使用过滤器会给出 "cannot invoke filter with an argument list of type (Object) throws -> Bool,"但参数不会抛出

我无法确切地弄清楚Swift在这里期望什么样的参数列表,因为当我在swift数组上调用“filter”时出现错误。这是我的代码:funcsetDefaultBook(){varbook:BookletfetchRequest:NSFetchRequest=Book.fetchRequest()ifletfetchResults=try?managedObjectContext.fetch(fetchRequest){book=fetchResults.filter{$0.title==defaultBookTitle}}...}一本书是一个NSManagedObject,一本书的标题是

ios - 带有类型为 "cannot invoke initializer for type ' 的参数列表的 'UITextField' Int' 是什么意思?

在我的应用程序中,我有一串代码是lrs24=(30*Int(weight)!+70)*Int(factor)!;。看起来一切正常,但编译器说它“无法使用类型为‘UITextField’的参数列表为类型‘Int’调用初始化程序”。这是什么意思,我该如何解决?谢谢!PS-这是所有我的代码-importUIKitclassViewController:UIViewController,UITextFieldDelegate{@IBOutletweakvaranimalNum:UITextField!@IBOutletweakvarlogLabel:UILabel!@IBOutletweakv

command-line - 如何在不使用 Xcode 的情况下将多个 Swift 文件编译在一起?

我对Swift编程很感兴趣,但我不想使用Xcode,因为它对于我的实际使用来说太臃肿了。我知道这可能与Objective-C类似clang-fobjc-arcmain.mmyclass.m-oprog1刚刚列出了不同的.m文件,但我不知道如何使用Swift执行此操作。我可以使用基本的Swift命令行工具,比如swiftMyProgram.swift,它只生成一个名为MyProgram的二进制文件。据我所知,此命令不会让您同时编译多个.swift文件。理想情况下,像C++的makefile这样的系统将是理想的。目前有什么方法可以从命令行使用Swift执行此操作吗?

Swift 的步幅(从 : , 到 : , 由:)导致 "cannot invoke"

我是第一次使用Swift的步幅。但是,由于我无法使其正常工作,因此first即将成为最后一个:letboundingBox=createdShape.frame//=SKShapeNodestride(from:Int(boundingBox.minX),to:Int(boundingBox.maxX),by:10){结果是:Cannotinvoke'stride'withanargumentlistoftype'(from:Int,to:Int,by:Int,()->())'我做错了什么? 最佳答案 语法应该是:letboundi

ios - 错误——Command/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc 失败,退出代码为 1

我正在使用自定义键盘,如果我在类里面包含这段代码,我会收到错误消息:letisPad=UIDevice.currentDevice().userInterfaceIdiom==UIUserInterfaceIdiom.PadError-Command/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftcfailedwithexitcode1我需要这段代码,因为当用户在iPad上运行iPhone应用程序(如instagram)时,我需要加载iPhone键盘预

swift - 如何在 Swift 5.1 中修复 "Cannot invoke ' 无参数发送'

我一直在努力关注“介绍SwiftUI-构建您的第一个应用程序”WWDC19视频。本次演讲没有提供示例代码,但我一直在随着演示者的进行而创建它。虽然我在尝试创建商店时收到错误消息,即“无法在没有参数的情况下调用‘发送’”:didSet{didChange.send()}我是编程新手,正在努力解决问题。importSwiftUIimportCombineclassReferenceStore:BindableObject{varreferences:[Reference]{didSet{didChange.send()}}init(references:[Reference]=[]){se