gpt4 book ai didi

swift - 隐式 Objective-C 入口点 -[setPeriod_end_date :] is deprecated

转载 作者:行者123 更新时间:2023-11-30 11:35:36 25 4
gpt4 key购买 nike

我有一个名为“订阅”的数据类型,其中包含此数据

var id: String = ""
var card: SCard?
var plan_id: String = ""
var status: String = ""    
var cancel_at_period_end: Int = 0 // 1 canceled, 0 active
var period_end_date: String = ""
var trial_end_date: String = ""
var benefits: Benefits?

还有一个帮助我填充值的 init 方法

init (dictionary: [String: Any]) {
        super.init ()
        setValuesForKeys (dictionary)
}

在“setValuesForKeys”方法中,我使用 super.setValue 方法

let uppercasedFirstCharacter = String (key.first!). uppercased ()
let range = NSMakeRange (0, 1)
let selectorString = NSString (string: key) .replacingCharacters (in: range, with: uppercasedFirstCharacter)
let selector = NSSelectorFromString ("set \ (selectorString):")
let responds = self.responds (to: selector)
if! responds {
return
}
super.setValue (value, forKey: key)

但是这个“警告”给我留下了深刻的印象

implicit Objective-C entrypoint - [Suscription setPeriod_end_date:] is deprecated and will be removed in Swift 4
implicit Objective-C entrypoint - [Suscription setPlan_id:] is deprecated and will be removed in Swift 4
implicit Objective-C entrypoint - [Suscription setStatus:] is deprecated and will be removed in Swift 4
implicit Objective-C entrypoint - [Suscription setTrial_end_date:] is deprecated and will be removed in Swift 4

如何解决?

最佳答案

尝试更改此设置:

目标 -> build设置 -> 搜索“推理” -> 将“Swift 3 @objc Inference”更改为“默认”。

关于swift - 隐式 Objective-C 入口点 -[setPeriod_end_date :] is deprecated,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49820481/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com