Same problem with iOS 11 and TwitterKit 3.1.0
Configuration:
- iPhone 5s, iPad Air
- iOS 11 beta 6.
- TwitterKit 3.1.0
- New empty project. TwitterKit installed manually. Followed all steps from TwitterKit docs.
Case 1: Twitter App did NOT INSTALLED from AppStore
Code from TwitterKit docs:
import UIKit
import TwitterKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
if (Twitter.sharedInstance().sessionStore.hasLoggedInUsers()) {
// App must have at least one logged-in user to compose a Tweet
let composer = TWTRComposerViewController.emptyComposer()
present(composer, animated: true, completion: nil)
} else {
// Log in, and then check again
Twitter.sharedInstance().logIn { session, error in
if session != nil { // Log in succeeded
let composer = TWTRComposerViewController.emptyComposer()
self.present(composer, animated: true, completion: nil)
} else {
let alert = UIAlertController(title: "No Twitter Accounts Available", message: "You must log in before presenting a composer.", preferredStyle: .alert)
self.present(alert, animated: false, completion: nil)
}
}
}
}
}
Produces non-closable alert:
And error in console:
[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>
}
Case 2: Twitter App did INSTALLED from AppStore
Same code open Twitter App with connection dialog. Then go back to the TestApp and present Composer and successfully post one time. Second time, after checking if(Twitter.sharedInstance().sessionStore.hasLoggedInUsers()) { … – nothing happens.
So, i found only one way for successfully share something with twitter composer:
- Logout from any twitter accounts
- Login with connection dialog in TwitterApp
- Call twitter composer
If you have not install TwitterApp catch the non-closable alert…