1
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)
        }
    }

尝试使用和不使用“外观”修改,第一次单击时发送请求按钮始终不可见。但是,一旦我取消并再次触发视图-一切都很好。

也尝试过从主线程显式调用。

还有其他人遭受同样的问题吗?

第一个触发器: 在此处输入图像描述

第二次触发: 在此处输入图像描述

4

1 回答 1

2

我认为,因为您使用 nil 视图控制器进行身份验证。试试这个

  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)
            }
        }
于 2016-09-19T05:24:57.333 回答