1
我剛剛開始使用Digits-Twitter API進行電話號碼驗證,但似乎無法讀取用戶的電話號碼,我不確定是否有該功能,但在閱讀一段時間後我知道我可以在成功通過電話驗證後回撥電話,但沒有解釋!如何獲取用戶的電話號碼?
AuthConfig.Builder authConfigBuilder = new AuthConfig.Builder()
.withAuthCallBack(callback)
.withPhoneNumber(phoneNumberOrCountryCodeFromMyActivity)
找到這個片段,但又不知道在哪裏實施它。
這是我行動的登錄按鈕使用電話驗證:
fileprivate func navigateToMainAppScreen() {
performSegue(withIdentifier: "signedIn", sender: self)
}
@IBAction func tapped(_ 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 {
// Navigate to the main app screen to select a theme.
self.navigateToMainAppScreen()
} else {
print("Error")
}
}
}
的可能的複製[編程在iOS自己的電話號碼(http://stackoverflow.com/questions/193182/programmatically-get-own-phone-number- in-ios) –
簡短的回答是「沒有辦法」。你必須要求用戶手動輸入。有私人的API訪問用戶的電話號碼,但然後蘋果將拒絕您的應用程序 –
我只想獲得用戶在Digits API屏幕中手動輸入的號碼,以便我可以創建我自己的數據庫 –