草庐IT

event_generate

全部标签

ios - UIWindow 子类 : Touches event not get fired

我想在当前项目中实现session时间功能。因此,为此我尝试子类化UIWindow并覆盖touchesBegan和touchesEnded方法。classBaseWindow:UIWindow{convenienceinit(){self.init(frame:UIScreen.mainScreen().bounds)}privatevarsessionTimeOutTimer:NSTimer?overridefunctouchesBegan(touches:Set,withEventevent:UIEvent?){sessionTimeOutTimer?.invalidate()}o

ios - 错误 "$T5??' 在 Swift 中没有名为 'Generator' 的成员?

我尝试在Swift中使用allContactedBodies()但我一直收到错误'$T5??'没有名为“Generator”的成员:classSense:SKNode{overrideinit(){super.init()}requiredinit(coder:NSCoder){fatalError("NSCodingnotsupported")}init(size:CGSize){//Initializeshapesuper.init()//PhysicPropertiesself.physicsBody=SKPhysicsBody(rectangleOfSize:size)self

swift - swift 中 "event listeners"的想法如何分为 Action 和协议(protocol)?

我的问题作为一名正在学习Swift的新程序员。我想知道为什么在事件监听器的实现方式之间似乎存在任意划分。在一些教程中,指出您可以简单地在Storyboard上的View元素和ViewController之间拖动以创建Action(事件监听器)。@IBActionfuncclickButtonListener(_sender:UIButton){print("helloworld")}但在后面的教程中,我注意到某些类似事件监听器的功能也以协议(protocol)的形式实现classViewController:UIViewController,UIScrollViewDelegate{f

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

core-data - 核心数据错误 : 'AnyObject' does not have a member named 'Generator'

我无法弄清楚这里出了什么问题。代码只是将username和password添加到实体“Users”,然后检索它。代码运行良好,直到我在其中添加了一个for循环。我什至尝试将AnyObject转换为NSManagedObject(据我所知这不是必需的)代码:importUIKitimportCoreDataclassViewController:UIViewController{overridefuncviewDidLoad(){super.viewDidLoad()//Doanyadditionalsetupafterloadingtheview,typicallyfromanib.v

ios - swift 错误 : Could not determine generated file paths for Core Data code generation:

我想运行应用程序后将我的Xcode文件移动到iCloudDrive,但出现此错误:无法确定核心数据代码生成的生成文件路径:ErrorDomain=NSCocoaErrorDomainCode=260“路径/Users/sebastianeppler/Library/MobileDocuments/com~apple~CloudDocs/Xcode上没有模型的当前版本/OnlyFun/OnlyFun/OnlyFun/OnlyFun.xcdatamodeld:"UserInfo={NSFilePath=/Users/sebastianeppler/Library/MobileDocumen

ios - CoreLocation 线程崩溃崩溃 : com. apple.CoreLocation.ConnectionClient.0x16fcb870.events

我在我们的生产应用程序中遇到了Apple的CoreLocation线程崩溃。我无法在我的测试中重现它,也很难弄清楚它是在CoreLocation内部。目前它只发生在少数人口中,但我可以看到它正在变得越来越大。Crashed:com.apple.CoreLocation.ConnectionClient.0x16fcb870.events0CoreLocation0x2aa2db54CLClientCreateIso6709Notation+536751CoreLocation0x2aa2dc7bCLClientCreateIso6709Notation+539702CoreLocati

ios - event.touchesForView().AnyObject() 在 Xcode 6.3 中不起作用

这在之前非常有效:funcdoSomethingOnDrag(sender:UIButton,event:UIEvent){lettouch=event.touchesForView(sender).AnyObject()asUITouchletlocation=touch.locationInView(sender)}但是在Xcode6.3中,我现在得到错误:Cannotinvoke'AnyObject'withnoarguments我该如何解决这个问题? 最佳答案 在1.2中,touchesForView现在返回原生SwiftS

swift - $T4 没有名为 Generator ERROR swift 的成员

@IBActionfuncbutton(sender:AnyObject){varvideoConnection:AVCaptureConnection!videoConnection=nilvarconnection:AVCaptureConnectionvarport:AVCaptureInputPortvarstillImageOutput:AVCaptureStillImageOutput?forconnectioninstillImageOutput?.connections{//thislineiswheretheerroris}我正在尝试使用我的自定义相机拍照,但出现此错

ios - Swift iOS 构建期间的 "clang: error: cannot specify -o when generating multiple output files"

我刚刚使用CocoaPods为我的SwiftiOS项目安装了一个额外的依赖项(HockeyAppSDK),现在我的项目在构建过程中失败并给出错误:clang:error:cannotspecify-owhengeneratingmultipleoutputfiles我卸载了依赖项,但项目在构建过程中仍然失败并出现相同的错误。有想法该怎么解决这个吗?编辑:使用xcodecli构建时,错误如下所示:2015-07-2420:28:09.378xcodebuild[34313:1668414]流错误:偏移量29处的流错误:由不受支持的XCDependencyGraph构建创建以下构建命令失败