Send a tweet from iPhone app

后端 未结 4 1153
旧时难觅i
旧时难觅i 2021-01-15 20:08

I want to add a simple limited Twitter function to my app: a user of the app enters his Twitter username and password and tweet text, and presses a button and the tweet is s

相关标签:
4条回答
  • 2021-01-15 20:16

    If all you want is one-way posting to Twitter, you might be better off using ShareKit, which is a little simpler than the alternatives people have mentioned so far and also supports other services, such as Facebook.

    0 讨论(0)
  • 2021-01-15 20:24

    For those in 2015 looking for an answer for iOS it is the social framework

    #import <Social/Social.h>
    
    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
                {
                  UIImage *img = someImage;
    
                SLComposeViewController *tweetSheet = [SLComposeViewController
                                                       composeViewControllerForServiceType:SLServiceTypeTwitter];
                [tweetSheet setInitialText: @"my tweet text change it to your needs"];
                [tweetSheet addImage:img];
                [tweetSheet addURL:[NSURL URLWithString:@"http://yoursite.com"]];
                [self presentViewController:tweetSheet animated:YES completion:nil];
        }
    
    0 讨论(0)
  • 2021-01-15 20:28

    You can use this engine that integrates the Twitter API with Objective C:

    MGTwitterEngine

    And a good tutorial here:

    Tutorial

    I used this engine, and its overall very easy to use.

    0 讨论(0)
  • 2021-01-15 20:28

    Check bengottlieb / Twitter-OAuth-iPhone for a complete implementation of the API.

    You have to implement O-Auth and can't simply manage your users' password and login yourself anymore. Twitter-Oauth-iPhone includes MGTwitterEngine by Matt Gemmell, OAuthConsumer Framework by Jon Crosby, OAuth-MyTwitter by Chris Kimpton, etc. in a relatively simple programming interface.

    0 讨论(0)
提交回复
热议问题