Comment télécharger des photos à Plixi (Tweetphoto) en utilisant OAuth?
-
30-09-2019 - |
Question
Je suis en train de créer une application iPhone dans lequel je dois télécharger des photos à l'aide de différents services. Je suis des photos avec succès dans Twitpic avec de téléchargement des & yfrog mais pas en mesure de le faire avec Plixi. J'utilise OAuth, comme Twitter ne permet pas l'authentification de base.
Si quelqu'un a essayé avec Plixi, s'il vous plaît aidez-moi !!
J'ai googlé beaucoup mais pas obtenir toute la documentation pertinente pour la nouvelle OAuth pour Plixi.
La solution
Enfin, je suis avec une solution pour mon problème:)
Si quelqu'un est aussi coincé avec ce problème, ajoutez simplement le dossier TweetPhoto à partir du lien d'application suivant: http: / /code.google.com/p/tweetphoto-api-objective-c/downloads/detail?name=TPAPI-Objective-C-Library.zip
Modifier les urls Tweetphoto pour Plixi maintenant. En outre, peut se référer à mon code suivant pour faire des appels de fonction:
-(void)uploadtoTweetPhoto{
NSString *message = [self.tweetTextView.text stringByReplacingOccurrencesOfString:@"Max. 140 characters" withString:@""];
NSMutableDictionary *dictionary = [[NSMutableDictionary alloc]init];
if((message == nil) || ([message isEqual:@""])){
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Please enter your tweet message.." message: @"" delegate:nil cancelButtonTitle: @"Ok" otherButtonTitles: nil];
[alert show];
[alert release];
}
else{
[dictionary setObject:message forKey:@"message"];
}
if([dictionary count] == 1){
[indicator startAnimating];
[NSThread detachNewThreadSelector:@selector(uploadPhotoToTweetPhoto:) toTarget:self withObject:dictionary];
}
[dictionary release];
}
- (void)uploadPhotoToTweetPhoto:(NSDictionary *)dictionary{
NSString *message = [dictionary objectForKey:@"message"];
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *accessTokenKey = [[NSUserDefaults standardUserDefaults] valueForKey:@"oauth_token"];
NSString *accessTokenSecret = [[NSUserDefaults standardUserDefaults] valueForKey:@"oauth_token_secret"];
TweetPhoto *tweetPhoto = [[TweetPhoto alloc] initWithSetup:accessTokenKey identitySecret:accessTokenSecret apiKey:Plixi_API_Key serviceName:@"Twitter" isoAuth:YES];
NSData *dat =[tweetPhoto upload:UIImageJPEGRepresentation(self.imgView.image,0.8) comment:message tags:@"" latitude:23.4646 longitude:-87.7809 returnType:TweetPhotoCommentReturnTypeXML];
NSString *status =[NSString stringWithFormat:@"%i",[tweetPhoto statusCode]];
[tweetPhoto release];
[self performSelectorOnMainThread:@selector(photoUploadedtoTweetPhoto:) withObject:status waitUntilDone:[NSThread isMainThread]];
[pool release];
}
- (void)photoUploadedtoTweetPhoto:(NSString*)status{
[indicator stopAnimating];
if([status isEqualToString:@"201"])
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Tweet Posted" message: @"" delegate:nil cancelButtonTitle: @"Ok" otherButtonTitles: nil];
[alert show];
[alert release];
}
else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Tweet Failed" message: @"" delegate:nil cancelButtonTitle: @"Ok" otherButtonTitles: nil];
[alert show];
[alert release];
}
}
Autres conseils
Je suis curieux de la phrase que vous avez utilisé dans Google. Dans tous les cas, googler outil "api Plixi" moi cette page , qui relie à un wrapper Cocoa sur Google code