Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Can't upload image by using API Client #36

Closed
semionenko opened this issue Jul 31, 2013 · 5 comments
Closed

Can't upload image by using API Client #36

semionenko opened this issue Jul 31, 2013 · 5 comments

Comments

@semionenko
Copy link

I can authenticate successfully:
[[TMAPIClient sharedInstance] authenticate:@"myapp" callback:^(NSError *error) {
if (error)
NSLog(@"Authentication failed: %@", error);
else
{
[[TMAPIClient sharedInstance] photo:@""
filePathArray:@[[fileURL path]]
contentTypeArray:@[@"image/png"]
parameters:@{@"caption" : @"Caption"}
callback:^(id response, NSError *error) {
if (error)
NSLog(@"Error posting to Tumblr %@", error);

                                               else
                                                   NSLog(@"Posted to Tumblr");
                                           }];
            }

}];

TMTumblrSDK from pods.

Error Domain=Request failed Code=404 "The operation couldn’t be completed. (Request failed error 404.)"

@irace
Copy link
Contributor

irace commented Aug 25, 2013

You need to pass the blog name instead of an empty string to the photo:filePathArray:contentTypeArray:parameters:callback method.

@irace irace closed this as completed Aug 25, 2013
@ghost
Copy link

ghost commented Aug 31, 2013

I was getting the same error. Problem was I was passing the blog title shown in tumblr.com while I had to pass blog name. Please don't confuse with name and title of blog.
You can see all blogs name by using:

  [[TMAPIClient sharedInstance] userInfo:^(id userInfo, NSError *error) {

         NSLog(@"%@", userInfo);
  }];

@ChiragSunshine
Copy link

Hello All

I have same issue(cant upload image to tumblr).However when I try to upload image with simulator(i.e running project in simulator) it works perfectly but when I run on device(making pod library for device and so on) I am able to authenticate but cant upload image.

I have taken care of blog name as suggested by vksaini13.Below is my code.

//This code fetches user info,I am using blog name from this...
[[TMAPIClient sharedInstance] userInfo:^(id userInfo, NSError *error) {

    NSLog(@"%@", userInfo);
}];

//Posting photo.
[[TMAPIClient sharedInstance] photo:@"nirravsun"
filePathArray:@[[[NSBundle mainBundle] pathForResource:@"blue" ofType:@"png"]]
contentTypeArray:@[@"image/png"]
fileNameArray:@[@"blue.png"]
parameters:@{@"caption" : @"Caption"}
callback:^(id response, NSError error) {
if (error)
{
NSLog(@"Error posting to Tumblr %@ \n ",[error description]);
/

I am printing error description.This gives me below error:

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

*/

                               }

                               else
                               {
                                   NSLog(@"Posted to Tumblr");
                               }

                           }];

//
Thanks..

@irace
Copy link
Contributor

irace commented Sep 4, 2013

Are you able to confirm (either by setting a breakpoint or using an HTTP proxy like Charles) that you're actually sending a multipart payload over the wire?

@nitinkraghuwanshi
Copy link

hello guys,
i am able to authenticate successfully and also able fetch the user info but not able to post any this i am using following code that was given in example app, i.e:
[[TMAPIClient sharedInstance] photo:@"xyz.tumblr.com"
filePathArray:@[@"blue.png"]
contentTypeArray:@[@"image/png"]
fileNameArray:@[@"blue.png"]
parameters:@{@"caption" : @"Caption"}
callback:^(id response, NSError *error) {
if (error)
NSLog(@"Error posting to Tumblr");
else
NSLog(@"Posted to Tumblr");
}];
Does any one got the correct response . Please help if any has done this successfully.
Thanks in advance.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants