【发布时间】:2017-04-12 14:11:33
【问题描述】:
我正在使用 Digits - by Twitter API 进行电话号码验证,一个快速的场景:用户点击注册按钮ex: LoginViewController -> Digits API 初始化以验证他的电话号码 ->成功验证后,应用程序应该移动到下一个视图控制器ex: HomeViewController,但是当用户成功验证时,应用程序返回到上一个视图控制器LoginViewController!这是我的代码:
LoginViewController
// MARK: - Sign Up Button
@IBAction func signUpPressed(_ sender: Any) {
let configuration = DGTAuthenticationConfiguration(accountFields: .defaultOptionMask)
configuration?.appearance = DGTAppearance()
configuration?.appearance.backgroundColor = UIColor.white
configuration?.appearance.accentColor = UIColor.red
// Start the Digits authentication flow with the custom appearance.
Digits.sharedInstance().authenticate(with: nil, configuration:configuration!) { (session, error) in
if session != nil {
//Print Data
print(session?.phoneNumber!)
print(session?.userID!)
// Navigate to the main app screen to select a theme.
self.performSegue(withIdentifier: "toSignUpVC", sender: self)
} else {
print("Error")
}
}
}
故事板示例:
注意: App返回LoginViewController后我再次点击SignUp Button后可以成功进入SignUpViewController,因为Digits是第一次注册设备,所以Digits为什么没有移动到下一个 View Controller 而不是回到 LoginViewController,任何用户都永远不会知道他是否成功注册!
【问题讨论】:
标签: swift3 ios10 twitter-fabric twitter-digits google-fabric