我正在與夫特3在iOS 10. sharedInstance()
方法引發錯誤,當用戶拒絕權限從系統或帳戶以考慮不配置(例如到控制檯「無法寫入應用獲取錯誤使用系統帳戶進行身份驗證「)。錯誤在進入關閉之前在控制檯上顯示。我不會在應用中向用戶顯示此錯誤警惕。這是我的代碼:從Twitter.sharedInstance()夫特3的iOS 10
Twitter.sharedInstance().logIn { (session, error) in
if error != nil {
// print(error?.localizedDescription ?? " ")
return
})
我得到這個錯誤:
2016-11-29 14:49:09.023 CarReview[1254:31719] [TwitterKit] did encounter error with message "Unable to authenticate using the system account.": Error Domain=TWTRLogInErrorDomain Code=2 "User allowed permission to system accounts but there were none set up." UserInfo={NSLocalizedDescription=User allowed permission to system accounts but there were none set up.}
2016-11-29 14:49:09.024 CarReview[1254:31719] [TwitterKit] No matching scheme found.
2016-11-29 14:49:09.292 CarReview[1254:31719] [TwitterKit] did encounter error with message "Error obtaining user auth token.": Error Domain=TWTRLogInErrorDomain Code=-1 "<?xml version="1.0" encoding="UTF-8"?>
<hash>
<error>Desktop applications only support the oauth_callback value 'oob'</error>
<request>/oauth/request_token</request>
</hash>
" UserInfo={NSLocalizedDescription=<?xml version="1.0" encoding="UTF-8"?>
<hash>
<error>Desktop applications only support the oauth_callback value 'oob'</error>
<request>/oauth/request_token</request>
</hash>
}
我想向用戶展示這一點:「無法使用系統帳戶驗證用戶允許的權限系統帳戶,但什麼都沒有設置向上。」
是不是我的意思。在關閉呼叫之前在控制檯上顯示錯誤,我對此沒有影響。我不會向用戶顯示這個錯誤。控制檯上的錯誤顯示了它自己。 –
如果你不希望它在控制檯關閉前被印刷出來,您需要在我的答案添加DispatchQueue.main.async等。 –
儘管我沒有控制錯誤,但是控制檯出錯了,但它不是我的打印功能。 –