2010-11-24 4 views

Répondre

3

Stefan Arentz's Twitter library est un plaisir à utiliser - il contient les vues dont vous avez besoin, il n'y a fondamentalement pas de codage à faire. Faites register your app tôt avec twitter et obtenez une soumission pour demander l'autorisation d'authentification xAuth afin que vous n'ayez pas à utiliser la méthode oAuth web maladroite. Avec xAuth, il est aussi simple que de soumettre un nom d'utilisateur et un mot de passe et de conserver le jeton d'authentification retourné pour envoyer un tweet.

0

est un exemple:

Appel -(void)sendTweet de votre 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]; 
    } 
} 
Questions connexes