Reputation: 2343
Our app has sharing options with Twitter that was implemented with third party libraries and I'm trying to re-implement them. Before, we used MGTwitterEngine, SA_OAuthTwitterController and REComposeViewController to link and post message to Twitter. Everything works fine but I don't like the fact that we started getting problems as we started supporting new iOS version and dropping old ones.
I decided to stay away from those third party libraries and already implemented with Social framework. Considering the post, it looks pretty good and the implementation itself become quite simple but there's a PROBLEM. SLComposeViewController's completion block doesn't tell you that the post was successful or not. I need to know if the post was successful or not because I'm making extra api call to our server to keep tracks of user's posts if the post is successful.
Here are my questions:
Should I give up the SLComposeViewController and make the post call manually or it's better just use third party libraries for this particular case? Is there any way I can get around while still taking advantage of using SLComposeViewController?
Thanks for any inputs/idea from you guys in advance.
Upvotes: 3
Views: 572
Reputation: 314
This is old, but heres an answer for anyone who stumbles upon it like I did.
Reference: Tutorial for SLComposeViewController sharing
You first set a completion handler for the SlComposeViewController:
SLComposeViewController *tweetSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
[tweetSheet setInitialText:@"put your #tag"];
[tweetSheet addImage:self.imageToSend];
[tweeter setCompletionHandler:^(SLComposeViewControllerResult result) {
switch (result) {
case SLComposeViewControllerResultCancelled:
NSLog(@"Post Canceled");
break;
case SLComposeViewControllerResultDone:
NSLog(@"Post Sucessful");
break;
default:
break;
}
}];
Then present it with that completion handler already set:
[self tweeter animated:YES completion:nil];
Upvotes: 4