Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Http 将用户配置文件pic发布到twitter,给出错误131_Http_Post_Twitter_Ios7 - Fatal编程技术网

Http 将用户配置文件pic发布到twitter,给出错误131

Http 将用户配置文件pic发布到twitter,给出错误131,http,post,twitter,ios7,Http,Post,Twitter,Ios7,在尝试将用户个人资料图片发布到twitter时,我收到了错误代码131的回复: 2013-12-06 19:17:29.854 Tweetly[8131:60b] { errors = ( { code = 131; message = "Internal error"; } ); } Twitters网站列出了以下内容: “与HTTP 500对应-发生未知的内部错误。” 这

在尝试将用户个人资料图片发布到twitter时,我收到了错误代码131的回复:

2013-12-06 19:17:29.854 Tweetly[8131:60b] {
    errors =     (
                {
            code = 131;
            message = "Internal error";
        }
    );
}
Twitters网站列出了以下内容:

“与HTTP 500对应-发生未知的内部错误。”

这是我的密码:

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


    //Code for store image
    [picker dismissViewControllerAnimated:YES completion:nil];

    UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];

    UIImage *scaledImage = [self imageWithImage:image convertToSize:CGSizeMake(500, 500)];
    NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(scaledImage)];

    [self uploadPictureWithData:imageData];

}


- (UIImage *)imageWithImage:(UIImage *)image convertToSize:(CGSize)size {

    UIGraphicsBeginImageContext(size);
    [image drawInRect:CGRectMake(0, 0, size.width, size.height)];
    UIImage *destImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return destImage;

}



- (void)uploadPictureWithData:(NSData *)imageData {

    // Get the twitter feed
    NSURL *requestURL = [NSURL URLWithString:@"https://api.twitter.com/1.1/account/update_profile_image.json"];

    // Set up proper parameters
    NSMutableDictionary *timelineParameters = [[NSMutableDictionary alloc] init];
    [timelineParameters setObject:imageData forKey:@"image"];
    [timelineParameters setObject:@"1" forKey:@"skip_status"];

    // Create the Social Request
    SLRequest *postRequest = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodPOST URL:requestURL parameters:timelineParameters];
    postRequest.account = self.delegate.userAccount;

    // Perform the request
    [postRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
        dispatch_async(dispatch_get_main_queue(), ^{
            // Check if we reached the reate limit
            if ([urlResponse statusCode] == 429) {

                // Rate limit reached
                // Display an alert letting the user know we have hit the rate limit

                UIAlertView *twitterAlert = [[UIAlertView alloc] initWithTitle:kRateLimitTitle
                                                                       message:kRateLimitMessage
                                                                      delegate:nil
                                                             cancelButtonTitle:@"Ok"
                                                             otherButtonTitles:nil];
                [twitterAlert show];

                return;

            }
            // Check if there was an error
            if (error) {

                NSLog(@"Error: %@", error.localizedDescription);
                return;

            }
            // Check if there is some response data
            if (responseData) {
                NSError *jsonError = nil;
                NSMutableArray *feedData = [NSJSONSerialization JSONObjectWithData:responseData options:0 error:&jsonError];
                if (!jsonError) {

                    // Check the response data

                    NSLog(@"%@", feedData);

                } else {

                    // Alert the user with the error
                    UIAlertView *twitterAlert = [[UIAlertView alloc] initWithTitle:kErrorTitle
                                                                           message:kErrorMessage
                                                                          delegate:nil
                                                                 cancelButtonTitle:@"Ok"
                                                                 otherButtonTitles:nil];
                    [twitterAlert show];


                }
            } else {

                // Alert the user with the error
                UIAlertView *twitterAlert = [[UIAlertView alloc] initWithTitle:kErrorTitle
                                                                       message:kErrorMessage
                                                                      delegate:nil
                                                             cancelButtonTitle:@"Ok"
                                                             otherButtonTitles:nil];
                [twitterAlert show];


            }


        });
    }];


}
知道问题是什么吗?我最初认为这是因为图像太大,所以我添加了将图像缩小到500 x 500的方法,但我得到了相同的错误

此错误在设备和模拟器上运行时发生


有没有人知道问题在哪里,或者有什么额外的见解?谢谢

在我的测试中,大于1000x1000px的图像不会同步缩小,从而抛出
131
响应代码。不幸的是,没有记录


确保图像是Hi,你有没有遇到131错误?当我想从mac应用程序在twitter上上传图像时,我也遇到了同样的问题。