I am trying to use the TwitterKit to compose a tweet, via the TWTRComposer class provided. This is the function I call:
-(void) tweet:(UIViewController *) root {
TWTRComposer *composer = [[TWTRComposer alloc] init];
[composer setText:@"just setting up my Twitter Kit"];
// Called from a UIViewController
[composer showFromViewController:root completion:^(TWTRComposerResult result) {
if (result == TWTRComposerResultCancelled) {
NSLog(@"Tweet composition cancelled");
}
else {
NSLog(@"Sending Tweet!");
}
}];
}
There are two problems with this:
- When the Twitter app is installed on my device, the TWTRComposer dialog is presented, but shortly after, another alert is presented on top, that that has the title: "No Twitter Account", and the following message: "There are no Twitter accounts configured. You can add or create a Twitter account in Settings." I can dismiss this dialog, and then send the tweet (successfully), but this is obviously very bad UX. Also, this error dialog is strange, as iOS 11 doesn't have Twitter in Settings anymore.
- When the Twitter app is not installed on my device, the TWTRComposer dialog is not presented at all. Instead, the completion block in the
showFromViewController
method is called immediately, with a result of type TWTRComposerResultCancelled.
I have a feeling this may be somehow related to login issues with Twitter. as The app I'm working on does not include Signup/Login with Twitter. However, I was under the impression the TWTRComposer handles all of the logging in.
Any help is truly appreciated, and thank you for reading!