草庐IT

method-removed-here

全部标签

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 - '初始化()' is deprecated: init() will be removed in Swift 3. Use ` 零`

我正在使用这段代码。varaudioUnit:AudioUnit=AudioUnit()但是在Xcode7.3(Swift2.2)中我收到了这个警告。知道为什么吗?我怎样才能摆脱它?注意如果我使用nil那么我的程序就会崩溃。 最佳答案 AudioUnit是AudioComponentInstance的类型别名,它本身是COpaquePointer的类型别名。InitializingpointerswillberemovedwithSwift3.0,只需将变量设置为nil。nil和AudioUnit()应该做同样的事情。如果您的程序因

ios - '初始化()' is deprecated: init() will be removed in Swift 3. Use ` 零`

我正在使用这段代码。varaudioUnit:AudioUnit=AudioUnit()但是在Xcode7.3(Swift2.2)中我收到了这个警告。知道为什么吗?我怎样才能摆脱它?注意如果我使用nil那么我的程序就会崩溃。 最佳答案 AudioUnit是AudioComponentInstance的类型别名,它本身是COpaquePointer的类型别名。InitializingpointerswillberemovedwithSwift3.0,只需将变量设置为nil。nil和AudioUnit()应该做同样的事情。如果您的程序因

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:

ios - '++' 已弃用 : it will be removed in Swift 3

这个问题在这里已经有了答案:The"++"and"--"operatorshavebeendeprecatedXcode7.3(12个答案)关闭6年前。更新到Xcode7.3后,我的项目中出现了一堆警告。'++'isdeprecated:itwillberemovedinSwift3有解决此警告的想法吗?++和--将来会被弃用的原因是什么?

ios - '++' 已弃用 : it will be removed in Swift 3

这个问题在这里已经有了答案:The"++"and"--"operatorshavebeendeprecatedXcode7.3(12个答案)关闭6年前。更新到Xcode7.3后,我的项目中出现了一堆警告。'++'isdeprecated:itwillberemovedinSwift3有解决此警告的想法吗?++和--将来会被弃用的原因是什么?

ios - 如何实现method swizzling swift 3.0?

如何在Swift3.0中实现方法调配?我读过nshipsterarticle关于它,但是在这段代码的block中structStatic{staticvartoken:dispatch_once_t=0}编译器报错dispatch_once_tisunavailableinSwift:Uselazilyinitializedglobalsinstead 最佳答案 首先dispatch_once_t在Swift3.0中不可用。您可以从两种备选方案中进行选择:全局变量struct、enum或class的静态属性有关更多详细信息,请参阅W