Wie Fotos zu Plixi (TweetPhoto) mit Oauth hochladen?
-
30-09-2019 - |
Frage
Ich schaffe eine iPhone-Anwendung, in denen muss ich Fotos mit verschiedenen Diensten hochladen. Ich bin erfolgreich in der Hochladen Foto mit Twitpic und Yfrog aber nicht in der Lage mit Plixi zu tun. Ich bin mit Oauth, wie Twitter ist nicht die Standardauthentifizierung ermöglicht.
Wenn jemand mit Plixi versucht hat, bitte helfen Sie mir !!
Ich habe viel gegoogelt aber keine entsprechenden Unterlagen für die neue Oauth für Plixi bekommen.
Lösung
Schließlich bin ich mit einer Lösung für mein Problem:)
Wenn jemand auch mit diesem Problem stecken, fügen Sie einfach den TweetPhoto Ordner aus dem folgenden Anwendungs ??Link: http: / /code.google.com/p/tweetphoto-api-objective-c/downloads/detail?name=TPAPI-Objective-C-Library.zip
Ändern Sie die TweetPhoto Urls für Plixi jetzt. Außerdem kann für die Herstellung von Funktionsaufrufen zu meinem folgenden Code verweisen:
-(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];
}
}
Andere Tipps
Ich bin neugierig auf die Phrase, die Sie in Google verwendet. In jedem Fall googeln "Plixi api" -Tool mich an Diese Seite , die Links zu einer Cocoa Wrapper auf Google Code