草庐IT

define_singleton_method

全部标签

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

swift 2.0 : use of self in method call before stored properties are initialised

这周末才开始研究Swift。我正在为我的类(class)创建一个id以快速比较对象。我想要一个不可变的id,所以应该使用let。使用var并将id初始化为""将修复"在初始化存储属性之前在方法调用中使用self"但当然它是可变的。我见过的与此类似的所有其他问题都是关于父类(superclass)/调用super.init,我没有。很郁闷,不知道为什么不直截了当。classMagicCard{letid:Stringletname:StringletmanaCost:Intletdescription:Stringletattack:Intletdefence:Intinit(name:

swift 2.0 : use of self in method call before stored properties are initialised

这周末才开始研究Swift。我正在为我的类(class)创建一个id以快速比较对象。我想要一个不可变的id,所以应该使用let。使用var并将id初始化为""将修复"在初始化存储属性之前在方法调用中使用self"但当然它是可变的。我见过的与此类似的所有其他问题都是关于父类(superclass)/调用super.init,我没有。很郁闷,不知道为什么不直截了当。classMagicCard{letid:Stringletname:StringletmanaCost:Intletdescription:Stringletattack:Intletdefence:Intinit(name:

微信小程序 Error: module ‘xxx.js‘ is not defined

可能是两种问题出现的报错一种是因为es6转es5没有开启还有一种可能是因为导入的js文件过大,自动跳过了es6转es5的处理推荐一个压缩js的网址:https://babeljs.io/repl

vue3 + vite出现 process is not defined 解决办法

vue3+vite出现processisnotdefined解决办法解决办法:在vite.config.js文件中添加define:{'process.env':{}}解决了

Mysql建表报错:Incorrect table definition; there can be only one auto column and it must be defined as a

报错:        Incorrect table definition; there can be only one auto column and it must be defined as a key.原因:        建表语句错误,表中只能包含一个自增列,且该列必须为键。问题是虽然这个表设置了其它主键,但是报错的建表语句中没有把自增列设为键导致的。解决方案:1、按照它说的把自增列设为主键或者取消自增约束。2、添加UNIQUEKEY约束:UNIQUEKEY(‘自增列名’)        UNIQUEKEY的作用:一是约束作用,规范数据的唯一性,但同时也在这个key上建立了一个唯一索