I used these code for sms verification using fabric digits in xcode 8.2.1 in swift3.
let authButton = DGTAuthenticateButton(authenticationCompletion: { (session, error) in
if (session != nil) {
let message = "Phone number: \(session!.phoneNumber)"
let alertController = UIAlertController(title: "You are logged in!", message: message, preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: .none))
self.present(alertController, animated: true, completion: .none)
} else {
NSLog("Authentication error: %@", error!.localizedDescription)
}
})
authButton?.center = self.view.center
self.view.addSubview(authButton!)
I got an error message when I click "send confirmation code", After I entered phone number. How can I solve this problem?
According to this https://docs.fabric.io/apple/digits/advanced-setup.html#verifying-a-user , You need to add :
Digits.sharedInstance().start(withConsumerKey: "Your API Key", consumerSecret: "Your Secret Key")
before
Fabric.with([Digits.self])
in your AppDelegate.swift file
This has solved my problem