草庐IT

instance-methods

全部标签

swift - NSInternalInconsistencyException',原因 : 'no UICollectionViewLayoutAttributes instance for -layoutAttributesForItemAtIndexPath, 自定义布局

我有一个带有自定义UICollectionLayout的UICollectionView。一切正常,直到我尝试插入一行……然后我收到以下错误,似乎无法弄清楚如何解决它。***Terminatingappduetouncaughtexception'NSInternalInconsistencyException',reason:'noUICollectionViewLayoutAttributesinstancefor-layoutAttributesForItemAtIndexPath:{length=2,path=0-0}'***Firstthrowcallstack:(0Core

ios - -[_SwiftValue encodeWithCoder :]: unrecognized selector sent to instance

尝试使用NSCoder时出现错误Player.swift:classPlayer:NSObject,NSCoding{privatevar_playerName:String!privatevar_playerScore:Int!privatevar_playerColor:PlayerColor!//PlayerColorisanenumvarplayerName:String{get{return_playerName}set{_playerName=newValue}}varplayerScore:Int{get{return_playerScore}set{_playerSco

ios - -[_SwiftValue encodeWithCoder :]: unrecognized selector sent to instance

尝试使用NSCoder时出现错误Player.swift:classPlayer:NSObject,NSCoding{privatevar_playerName:String!privatevar_playerScore:Int!privatevar_playerColor:PlayerColor!//PlayerColorisanenumvarplayerName:String{get{return_playerName}set{_playerName=newValue}}varplayerScore:Int{get{return_playerScore}set{_playerSco

Error:Attempt to invoke virtual method ‘void android.widget.TextView.setText(java.lang.CharSeq

在进行Android开发学习是遇到一个error:Attempttoinvokevirtualmethod‘voidandroid.widget.TextView.setText(java.lang.CharSequence)’onanullobjectreference原因:你定义的变量不被识别,他不知道是哪个。例如我的就是因为TextView有两个,系统不知道使用说,导致程序运行不起来。我的xml有两个Textview解决方法:找到我们需要使用的那个变量,给他定义明确就好了。总结:在进行大范围的变量,并且我们需要使用时,我们需要精确一点,确定我们要用的是哪一个变量,给他精确赋值,这样我们才

objective-c - swift 错误 : class method "someMethod() is unavailable, use object construction Class()"

Objective-CAPI使用类方法进行大量对象构建:+(NSDate*)date;+(NSURL*)urlWithString:(NSString*)string;+(instancetype)layerWithSession:(AVCaptureSession*)session有时我什至看到这些作为类方法出现在旧的Swift教程中,但是当我尝试调用它们时,我会遇到如下编译器错误:date()isunavailable,useobjectconstructionNSDate()urlWithString()isunavailable,useobjectconstructionNSU

objective-c - swift 错误 : class method "someMethod() is unavailable, use object construction Class()"

Objective-CAPI使用类方法进行大量对象构建:+(NSDate*)date;+(NSURL*)urlWithString:(NSString*)string;+(instancetype)layerWithSession:(AVCaptureSession*)session有时我什至看到这些作为类方法出现在旧的Swift教程中,但是当我尝试调用它们时,我会遇到如下编译器错误:date()isunavailable,useobjectconstructionNSDate()urlWithString()isunavailable,useobjectconstructionNSU

Android运行项目时提示:No signature of method: build_*.android() is applicable for argument types

报错意思:没有方法的签名:build_*.文件中  android()适用于参数类型我发生这种情况是因为:1AndroidStudio的版本较高(2021.3.1P1),2编译版本较高30,所以提示build.gradle的android插件有问题发现:1,高版本的application写法不同;2,android{   ......   } 中声明编译SDK版本的参数也不同。所以照上图中修正,就可以正常运行了。

org.apache.hc.client5.http.async.methods.SimpleRequestBuilder

使用阿里云发送短信时,使用response.get()方法报错加入以下maven依赖:org.apache.httpcomponents.client5httpclient55.1.3org.apache.httpcomponents.client5httpclient5-fluent5.1.3

ios - Swift 应用程序在 CLLocationManager 上崩溃并显示 `unrecognized selector sent to instance`

与StackOverflow上的许多其他问题类似,在运行我的应用程序时,我遇到了unrecognizedselectorsenttoinstance错误。让我的案例与众不同(我认为)的是它是用Swift编写的,而常见的原因不是这里的原因。在this问题解决方案是在身份检查器中将该View的“自定义类”设置为响应类。我检查了一下,情况确实如此(请注意,我确实在某个时候重命名了该类,但现在它肯定设置为“ViewController”)。我包括下面的堆栈跟踪以及ViewController.swift的代码。您还可以找到所有代码here.我通过重新开始设法避免了这个问题,这使我能够解决我的e

ios - Swift 应用程序在 CLLocationManager 上崩溃并显示 `unrecognized selector sent to instance`

与StackOverflow上的许多其他问题类似,在运行我的应用程序时,我遇到了unrecognizedselectorsenttoinstance错误。让我的案例与众不同(我认为)的是它是用Swift编写的,而常见的原因不是这里的原因。在this问题解决方案是在身份检查器中将该View的“自定义类”设置为响应类。我检查了一下,情况确实如此(请注意,我确实在某个时候重命名了该类,但现在它肯定设置为“ViewController”)。我包括下面的堆栈跟踪以及ViewController.swift的代码。您还可以找到所有代码here.我通过重新开始设法避免了这个问题,这使我能够解决我的e