Sunday, 25 August 2013

Error posting to Tumblr The operation couldn’t be completed. (Request failed error 400.)

Error posting to Tumblr The operation couldn't be completed. (Request
failed error 400.)

I am generating a gif and saving it in Documents Directory.
when i try to post Gif from NSBundle there is no issue but when i try to
upload gif from document directory, it authenticate successfully, but
shows error while posting i.e JXHTTPMultipartBody.m (78) ERROR: The
operation couldn't be completed. (Cocoa error 260.)
Error posting to Tumblr The operation couldn't be completed. (Request
failed error 400.).
code snippet i am using is
[TMAPIClient sharedInstance].OAuthConsumerKey =
@"gHTqzg8WGOuTAnuwmmLzPRzcAV8CoxVLCOUXlUN25Q0XLjyols";
[TMAPIClient sharedInstance].OAuthConsumerSecret =
@"Q7WLovQS2qR739tGyhH2hycmyoYc1a4OZ2dwl3B7ah7v0LGiAu";
[TMAPIClient sharedInstance].OAuthToken =
@"1KxwXLQ9ctrq4SpUKlrPiKZtT4skGHapejQYBdHBIKLc69XeMs";
[TMAPIClient sharedInstance].OAuthTokenSecret =
@"RSswzFPW5uvhkMtlJ0AU9KxF0ltDaTgPRn1EioISracAfn9sAf";
[[TMAPIClient sharedInstance] authenticate:@"myapp://tumblr-authorize"
callback:^(NSError *error) {
// You are now authenticated (if !error)
if (error)
NSLog(@"Authentication failed: %@ %@", error, [error
description]);
else{
NSLog(@"Authentication successful!");
[[TMAPIClient sharedInstance] photo:@"test.tumblr.com"
filePathArray:[[NSFileManager
defaultManager]contentsOfDirectoryAtPath:[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask,
YES)objectAtIndex:0]
error:NULL]
contentTypeArray:@[@"image/gif"]
parameters:@{@"caption" : @"Hello Gif"}
callback:^(id response, NSError
*error) {
if (error)
{
NSLog(@"Error posting to
Tumblr
%@",error.localizedDescription);
}
else
NSLog(@"Posted to Tumblr");
NSLog(@"response %@",response);
}];
}
}];

No comments:

Post a Comment