Как загрузить фотографии в Plixi (Tweetphoto), используя Oauth? - PullRequest
1 голос
/ 14 октября 2010

Я создаю приложение для iphone, в котором я должен загружать фотографии, используя различные сервисы. Я успешно загружаю фотографии с Twitpic & YFrog, но не могу сделать с Plixi. Я использую Oauth, поскольку Twitter не разрешает обычную аутентификацию.

Если кто-то пробовал использовать Plixi, пожалуйста, помогите мне !!

Я много гуглил, но не получаю соответствующей документации для нового Oauth для Plixi.

Ответы [ 2 ]

4 голосов
/ 18 октября 2010

Наконец, у меня есть решение для моей проблемы:)

Если кто-то также столкнулся с этой проблемой, просто добавьте папку TweetPhoto из следующей ссылки приложения: http://code.google.com/p/tweetphoto-api-objective-c/downloads/detail?name=TPAPI-Objective-C-Library.zip

Измените URL твитфото для Plixi сейчас.Кроме того, можете обратиться к моему следующему коду для вызова функций:

-(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];
    }

}
0 голосов
/ 14 октября 2010

Мне любопытно, что вы использовали в Google.В любом случае, прибегая к помощи «plixi api», я получаю доступ к этой странице , которая ссылается на упаковщик какао в Google Code .

...