"Send confirmation code" button on Digits API always invisible on first trigger

133 Views Asked by At
let digits = Digits.sharedInstance()
    let configuration = DGTAuthenticationConfiguration(accountFields: .DefaultOptionMask)
    configuration.appearance = DGTAppearance()
    //configuration.appearance.backgroundColor = UIColor.whiteColor()
    //configuration.appearance.accentColor = UIColor.init(hex: "3D3B50")
    configuration.appearance.accentColor = UIColor(red:0.33, green:0.67, blue:0.93, alpha:1.0)
    configuration.phoneNumber = "+65"


    digits.authenticateWithViewController(nil, configuration: configuration) { session, error in
        if (session != nil) {
            print(session!.phoneNumber)

        } else {
            NSLog("Authentication error: %@", error!.localizedDescription)
        }
    }

Tried with and without "appearance" modifications, the Send Request button on first click is always invisible. However once I cancel and trigger the view again - its all good.

Have also tried explicitly calling from the main thread.

Anyone else suffering from the same issue?

First trigger: enter image description here

Second trigger: enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

I think, because you authenticate with nil view controller. Try this one

  let digits = Digits.sharedInstance()
        let configuration = DGTAuthenticationConfiguration(accountFields: .DefaultOptionMask)
        configuration.appearance = DGTAppearance()
        configuration.appearance.accentColor = UIColor(red: 0.0/255.0, green: 170.0/255.0, blue: 255.0/255.0, alpha: 1.0)
        configuration.appearance.headerFont = UIFont(name: "Avenir-Light", size: 18)
        configuration.appearance.labelFont = UIFont(name: "Avenir-Light", size: 16)
        configuration.appearance.bodyFont = UIFont(name: "Avenir-Light", size: 16)
        digits.authenticateWithViewController(self, configuration:configuration) { session, error in
            if session != nil { 
                 print(session!.phoneNumber)
            } else {
                  NSLog("Authentication error: %@", error!.localizedDescription)
            }
        }