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

Cannot upload a photo on device #65

Closed
Kelvin-Hu opened this issue Jul 31, 2014 · 2 comments
Closed

Cannot upload a photo on device #65

Kelvin-Hu opened this issue Jul 31, 2014 · 2 comments

Comments

@Kelvin-Hu
Copy link

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    [TMAPIClient sharedInstance].OAuthConsumerKey = @".....";
    [TMAPIClient sharedInstance].OAuthConsumerSecret = @".....";

    return YES;
    }

-(void)postPhoto {
[[TMAPIClient sharedInstance] authenticate:@"photopostexample" callback:^(NSError *error) {
if (error)
NSLog(@"Authentication failed: %@ %@", error, [error description]);
else {
NSLog(@"Authentication successful!");

        [[TMAPIClient sharedInstance] photo:@"kelvinhu.tumblr.com"
                              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");
                                       else
                                           NSLog(@"Posted to Tumblr");
                                   }];
    }
}];

}

this code can run on the simulator successfully. but when I run it on the device, the error code 400 was showed, and cannot upload the photo.
Waiting for the answer.Thanks a lot.

@irace
Copy link
Contributor

irace commented Dec 13, 2014

Not sure but this doesn't sound like an SDK bug. Sounds like the response that I would expect the server to return if blue.png doesn't actually exist in the bundle.

I'd recommend using Charles Proxy to inspect the outgoing HTTP request that you're sending. If it's actually populated with image data and you're still getting a 400, it could be some problem with that image specifically.

@irace irace closed this as completed Dec 13, 2014
@ykws
Copy link

ykws commented Jun 22, 2017

Now simulator has a same error. #113

# 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

3 participants