草庐IT

Instance

全部标签

ios - 另一个 "unrecognized selector sent to instance"

Edit3:Forotherpeoplegettingthiserror,thisiswhathappenedhere.IoriginallycreatedtheIBActionfortheslideras"numberOfSounds".Ithencreatedaclasspropertycalled"numberOfSounds"andrenamedtheIBActionto"sliderValueChanged".Iexpectedtheconnectiontoautomaticallyupdatetheconnection,BUTITDOESN'T.So,sinceIdumbl

ios - 为什么我的 segue 导致 "unrecognized selector sent to instance"NSInvalidArgumentException?

尝试使用segue从我的第一个ViewController移动到我的第二个ViewController(都使用相同的Storyboard)。我的第一个ViewController有两个按钮,一个表示“男性”,一个表示“女性”(我知道,不是每个人都与这两个中的一个相关联),我希望其中一个按钮在单击后移动到第二个ViewController。我将按钮拖/放到我的代码中以获得以下内容:@IBActionfuncfemaleButton(_sender:AnyObject){Globals.onboardingList.append("girl")print("it'sagirl!")perf

swift - 检查对象是否是 Swift 中类元类型的实例

这个问题在这里已经有了答案:CheckwhetherSwiftobjectisaninstanceofagivenmetatype(3个答案)关闭5年前。我有一个各种类型的对象数组和一个类型数组。对于每个对象,我想遍历类型数组并查看该对象是否是该类型。像这样:classParent{}classChildA:Parent{}classChildB:Parent{}classGrandChildA:ChildA{}varobjects:[Any]=["foo",ChildA(),ChildA(),ChildB(),GrandChildA()]varclasses=[Parent,Chil

swift - 无法从 Swift 框架访问单例实例

使用Xcode6.3,我在Swift中创建了一个非常简单、人为设计的命令行工具。它包含三个模块。主要模块:importFoundationletdisplayer=ValueDisplayer()displayer.displayValue()一个ValueDisplayer模块:importFoundationclassValueDisplayer{funcdisplayValue(){println("Thevalueis\(ValueProvider.instance.value)")}}和一个ValueProvider模块:importFoundationpublicclass

macos - (NSMenuItem) : missing setter or instance variable

我遇到了一个奇怪的错误:2015-04-0212:20:14.642test[21167:257788]Failedtoconnect(testApp)outletfrom(test.AppDelegate)to(NSMenuItem):missingsetterorinstancevariableinsertedid:122我在将menuItem添加到菜单并将功能连接到它时发生。我不知道问题是什么。该应用程序运行良好,但我认为忽略错误不是一个明智的主意。setter或实例变量是什么意思?为什么需要它?更新:这是相关代码:importCocoaimportFoundation@NSAp

ios - '-[CIContext initWithOptions :]: unrecognized selector sent to instance

我用它来生成一个大图像:letcontext=CIContext(options:nil)letbitmapImage:CGImageRef=context.createCGImage(image,fromRect:extent)!CGContextSetInterpolationQuality(bitmapRef,CGInterpolationQuality.None)CGContextScaleCTM(bitmapRef,scale,scale);CGContextDrawImage(bitmapRef,extent,bitmapImage);letscaledImage:CGIm

ios - NSInternalInconsistencyException : There can only be one UIApplication instance

描述:尝试使用UIApplication类在我的应用程序中打开YoutubeURL。leturl=URL(string:"https://www.youtube.com/watch?v=smOp5aK-_h0")!letapp=UIApplication()ifapp.canOpenURL(url){//Crashhereapp.openURL(url)}问题:为什么当我尝试打开url时我的应用程序崩溃了?错误:*Assertionfailurein-[UIApplicationinit],*Terminatingappduetouncaughtexception'NSInternal

ios - [UIViewController TableView :numberOfRowsInSection:]: unrecognized selector sent to instance

我有一个连接到某些项目的标签栏View。我希望其中一个项目包含TableView,但我不想使用TableViewController,因为我想在页。我的ViewController实现了UITableViewDataSource和UITableViewDelegate这两个协议(protocol),并包含以下功能:functableView(_tableView:UITableView,numberOfRowsInSectionsection:Int)->Int{//Returnthenumberofrowsinthesection.returnannunci.count}functa

ios - Swift 中的结构值类型

我了解“值类型”和“引用类型”之间的区别。我知道“结构”是“值类型”,根据Swift文档,结构存储的所有值本身都是值类型。现在我的问题是,如果我在Struct中有一个存储属性,它是一个类的实例怎么办。在那种情况下,会复制整个类还是只复制其地址?如有任何帮助,我们将不胜感激。 最佳答案 它将指针复制到实例。我刚刚在Playground上对此进行了测试。structMyStruct{varinstance:MyClass}classMyClass{varname:Stringinit(name:String){self.name=nam

Vivado报错[place 30-484] The packing of LUTRAM/SRL instance

    在VivadoPr的时候报了一个错误:[Place30-484]ThepackingofLUTRAM/SRLinstanceintocapableslicescouldnotbeobeyde....后面会继续说LUTRAM超了多少,而且会报错在你的ila上。     这个错误实际上是你的ila加了不被允许加的inout类型的信号,因为inout信号既是输入也是输出,一般是复用信号,会被综合成ieinoe以及out信号,所以一对一布线的ila显然处理不过来,就会被认为是二维的数组而综合成了LURAM,知道原因了解决这个问题就很简单了,在ila上面拿掉inout信号,或者把你要抓的信号往深