ElGonzoGonzales
ElGonzoGonzales

Reputation: 1

implicit Objective-C entrypoint -[setPeriod_end_date:] is deprecated

I have a data type called 'Subscription' with this data

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?

And an init method that helps me fill the values

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

In the method 'setValuesForKeys' I use the super.setValue method

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)

but this 'Warning' marks me

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

How can I solve it?

Upvotes: 0

Views: 847

Answers (1)

Zhi Zhou
Zhi Zhou

Reputation: 1919

Try to change this setting:

Targets -> Build Settings -> search "Inference" -> change the "Swift 3 @objc Inference" to "Default".

Upvotes: 1

Related Questions