我正在创建一个iPhone应用程序,其中我必须使用不同的服务上传照片。我成功地使用Twitpic&Yfrog上传照片,但无法与Plixi一起使用。我正在使用OAuth,因为Twitter不允许基本身份验证。

如果有人尝试过Plixi,请帮助我!

我已经搜索了很多谷歌,但没有为Plixi的新Oauth提供任何相关文档。

有帮助吗?

解决方案

最后,我有解决问题的解决方案:)

如果有人也遇到了这个问题,只需从以下应用程序链接中添加TweetPhoto文件夹:http://code.google.com/p/tweetphoto-api obigntive-c/downloads/detail?name = tpapi-obigntive-c-library.zip

立即更改Plixi的TweetPhoto URL。另外,可以参考我的以下代码进行函数调用:

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

}

其他提示

我对您在Google中使用的短语感到好奇。无论如何,谷歌搜索“ plixi api”工具我 这一页, ,链接到 Google代码上的可可包装器.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top