nst / STTwitter

A stable, mature and comprehensive Objective-C library for Twitter REST API 1.1
BSD 3-Clause "New" or "Revised" License
999 stars 165 forks source link

Can't upload media (video) on iPhone 4 with ios8 #226

Closed AlexMeSh closed 8 years ago

AlexMeSh commented 8 years ago

Works fine on 5s, but on 4s not invoke any callback's. Maybe I do something wrong?

STTwitterAPI* api = [STTwitterAPI twitterAPIWithOAuthConsumerKey:twitterConsumerKey
                                                 consumerSecret:twitterConsumerSecret
                                                     oauthToken:[TwitterTokenControl token]
                                               oauthTokenSecret:[TwitterTokenControl tokenSecret]];

 [api postMediaUploadThreeStepsWithVideoURL:self.url
                                uploadProgressBlock:^(int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite) {
                                    [SVProgressHUD showProgress:(float)totalBytesWritten/(float)totalBytesExpectedToWrite
                                                       maskType:SVProgressHUDMaskTypeGradient];
                                } successBlock:^(NSString *mediaID, NSString *size, NSString *expiresAfter, NSString *videoType) {
                                    [SVProgressHUD showInfoWithStatus:@"Video uploaded complete. Post on twitter."];
                                    [self.api postStatusUpdate:self.textView.text
                                             inReplyToStatusID:nil
                                                      mediaIDs:@[mediaID]
                                                      latitude:nil
                                                     longitude:nil
                                                       placeID:nil
                                            displayCoordinates:nil
                                                      trimUser:nil
                                                  successBlock:^(NSDictionary *status) {
                                                      [SVProgressHUD showSuccessWithStatus:@"Complete"];
                                                      dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                                                          [SVProgressHUD dismiss];
                                                      });
                                                  } errorBlock:^(NSError *error) {
                                                      if (error) {
                                                          [SVProgressHUD dismiss];
                                                          [[[UIAlertView alloc]initWithTitle:@"Error" message:error.localizedDescription delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]show];
                                                      }
                                                  }];
                                } errorBlock:^(NSError *error) {
                                    if (error) {
                                        [SVProgressHUD dismiss];
                                        [[[UIAlertView alloc]initWithTitle:@"Error" message:error.localizedDescription delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]show];
                                    }

                                }];
nst commented 8 years ago

You should call

[STTwitterAPI verifyCredentialsWithUserSuccessBlock:errorBlock:]

before using the instance to post the media.

Also, please ensure to be using the very latest version from trunk, I just updated the class that handle network callbacks.

nst commented 8 years ago

I have no update so I close the issue.

Feel free to reopen it with more details.

The issue seems to be similar to https://github.com/nst/STTwitter/issues/233#issuecomment-156821886