How to integrate Twitter support into iOS app?

How to integrate Twitter support into iOS app?

+3
source share
2 answers

Stefan Arentz Twitter library is used with pleasure - it contains the views you need, mostly there is no coding. Make please register your application via twitter and get an idea to ask for permission to authenticate XAUTH, so you do not have to use a clunky web method oAuth, With XAUTH is as easy as sending a username and password and save the returned token authentication to send Tweets .

+3
source

Here is an example:

Call -(void)sendTweetfrom your IBAction.

// Sending tweets from within the application
-(void)sendTweet {
    // check if device capable of sending tweets
    if([TWTweetComposeViewControllercanSendTweet])
    {
        TWTweetComposeViewController *tweetSheet = [[TWTweetComposeViewControlleralloc] init];
        [tweetSheet setInitialText:@"Twitting from my iSecret App"];

        self.imageString = @"theSecret.png";

        if(self.imageString) {
            [tweetSheet addImage:[UIImageimageNamed:self.imageString]];
        }

        [selfpresentModalViewController:tweetSheet animated:YES];
    }
    else {
        UIAlertView *alert = [[UIAlertViewalloc]initWithTitle:@"Sorry"message:@"You can't send a tweet right now, make sure your device has an internet connection and you have at least one Twitter account setup"delegate:selfcancelButtonTitle:@"Ok"otherButtonTitles:nil];
        [alert show];
    }
}
0
source

Source: https://habr.com/ru/post/1776653/


All Articles