Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Large Photos Won't Upload #47

Closed
inb4ohnoes opened this issue Nov 17, 2013 · 6 comments
Closed

Large Photos Won't Upload #47

inb4ohnoes opened this issue Nov 17, 2013 · 6 comments
Assignees

Comments

@inb4ohnoes
Copy link
Contributor

Sorry for opening so many issues!

For some reason uploading a large image takes forever. Smaller filesize images upload just fine, but it seems that uploading any image taken with an iPhone (so far) will not upload correctly. It'll either return a timeout error or sit there endlessly uploading. Any ideas?

By the way the STTwitterDateFormatter is great! Thanks for your work!

@ghost ghost assigned nst Nov 17, 2013
@nst
Copy link
Owner

nst commented Nov 17, 2013

Thank you for reporting issues! Let me know which STTwitterAPI method is so slow and I'll do my best to optimize it.

@inb4ohnoes
Copy link
Contributor Author

Thank you for replying! The convenience method for posting a status with a picture is the one that I'm having issues with. I have not tried the other method.

@nst
Copy link
Owner

nst commented Nov 17, 2013

I can't manage to reproduce the issue.

I uploaded photos taken with an iPhone 5 while connected on wifi.

It took around 10-15 seconds, depending on the compression rate.

Here is the code I used to post https://twitter.com/nst021/status/402144049488224256

Is this very same code stalling for you?

- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info {

    UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];

    NSData *data = UIImageJPEGRepresentation(image, 0.5);

    [_twitter postStatusUpdate:@"test"
                mediaDataArray:@[data]
             possiblySensitive:nil
             inReplyToStatusID:nil
                      latitude:nil
                     longitude:nil
                       placeID:nil
            displayCoordinates:nil
                  successBlock:^(NSDictionary *status) {
                      // ...
                  } errorBlock:^(NSError *error) {
                      // ...
                  }];
}

@inb4ohnoes
Copy link
Contributor Author

Oh no I was using the one where you have to put an NSURL

@nst
Copy link
Owner

nst commented Nov 17, 2013

OK I just tried to upload a 3.2 MB photo and I get the following error from Twitter's server:

{
    errors =     (
                {
            code = 193;
            message = "One or more of the uploaded media is too large.";
        }
    );
}

So:

  1. be sure to handle the error properly
  2. prefer the alternative way I posted before

@inb4ohnoes
Copy link
Contributor Author

Hmm. I just get never ending uploading or a timeout error when I do that... I'll use the other method. Thanks!

Edit: I was about to report back saying this wasn't working either when i realized i was setting the image data to nil before it could finish uploading. good job me.

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

No branches or pull requests

2 participants