twitter接入问题记录

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

如图


twitter接入问题记录_第1张图片
Snip20170626_7.png

参考:
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 "

  Desktop applications only support the oauth_callback value 'oob'
  /oauth/request_token

" UserInfo={NSLocalizedDescription=

  Desktop applications only support the oauth_callback value 'oob'
  /oauth/request_token

}
  • 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

你可能感兴趣的:(twitter接入问题记录)