1,URL Scheme配置問題
question:
'Attempt made to Log in or Like a Tweet without a valid Twitter Kit URL Scheme set up in the app settings. Please see https://dev.twitter.com/twitterkit/ios/installation for more info.'
answer1:
I got it too, and you just have to do what it says, you have to add a URL scheme to the info.plist. It is explained in the link.answer2:
The trick was to add the scheme by itself with a new role. Not an issue if it's your first scheme but easy to mess up if you have multiple.
總結:
上面是兩個循序漸進的答案:
第一, info.flist里面增加一個 URL scheme;
第二,確保是在現有URL types下增加新的URL scheme,不是新增URL types
如圖
參考:
https://twittercommunity.com/t/twitterkit-v3-causes-exception-upon-sign-in-on-ios/88143/2
2, 需要設置Callback URL
- question:
[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>
}
- answer:
I am facing the same issue as in the question. I have just set the callBack Url into the Twitter App and resolved the issues.
Go to https://apps.twitter.com/app -> Settings -> Callback URL and Update Settings to save.
總結:
必須要設置Callback URL
Callback URL最新格式:
twitterkit-{consumer/api key}://
For example:
twitterkit-128238aKjqlp123AKdasdf://
如果不按照這樣設置,會報下面的錯誤:
Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings
參考:
https://stackoverflow.com/questions/40863953/getting-errors-from-twitter-sharedinstance-switf-3-ios-10