1
votes

When I try to update user details in parse then sometimes I got a error in saving user details.

Error something like this :

Error Domain=NSURLErrorDomain Code=-1021 "request body stream exhausted" UserInfo={NSUnderlyingError=0x7fd62c4aa980 {Error Domain=kCFErrorDomainCFNetwork Code=-1021 "request body stream exhausted" UserInfo={NSErrorFailingURLStringKey=http://files.parsetfss.com/, NSLocalizedDescription=request body stream exhausted, NSErrorFailingURLKey=http://files.parsetfss.com/}}, NSErrorFailingURLStringKey=http://files.parsetfss.com/, NSErrorFailingURLKey=http://files.parsetfss.com/, NSLocalizedDescription=request body stream exhausted}

Here is My Code :

- (IBAction)onEditProfile:(id)sender
{
        PFUser * user = [PFUser currentUser];
        user.username = email;
        user.email = email;
        user[PF_USER_EMAILCOPY] = email;
        user[PF_USER_FULLNAME] = [NSString stringWithFormat:@"%@ %@",firstName,lastName];
        user[PF_USER_FULLNAMELOWER] =  [[NSString stringWithFormat:@"%@ %@",firstName,lastName] lowercaseString];
        user[PF_USER_DIVISION_NAME] = divisionobj;
        user[PF_USER_TEAM_NAME] = teamobj;
        user[PF_USER_AVATAR_IMAGE] = avatarImage;
        user[PF_USER_FIRST_NAME] = firstName;
        user[PF_USER_LAST_NAME] = lastName;
        [user saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error)
         {
             if (!error && succeeded)
             {
                 [self alertshowWithTitle:ALERT_TITLE message:@"Your information has been updated successfully."];

                 //Set Theme Color Default.
                 [[NSUserDefaults standardUserDefaults] setObject:DEFAULT_THEME_COLOR forKey:kAppThemeHexColor];
                 [[NSUserDefaults standardUserDefaults] synchronize];

                 [self setAppThemeColor];
                 //hud.labelText = @"Sign up Success.";
                 [hud hide:YES afterDelay:0.0f];
             }
             else
             {
                 [hud hide:YES afterDelay:0.0f];
                 if (error!=nil)
                 {
                     if ([error code] == 100)
                     {
                         [self alertshowWithTitle:ALERT_TITLE message:@"Internet is not available."];
                     }
                     else
                     {
                         [self alertshowWithTitle:ALERT_TITLE message:@"Server is unreachable. Please try again later."];
                     }
                     return;
                 }
             }
         }];
}

I have googling to findout what is main reason to get this type of Issue.

Can anybody help to me to solve this problem? Thanks in Advance.

1
I think that your issue is with avatar image, you should try to create separate table for that one and use parse.com/questions/upload-image and connect it with the user. - Miknash
Thank you for helping. l have change code as you suggest. I think issue was fixed by change to it. - Hardik Shekhat
I will post it as an answer so you can accept it :) - Miknash

1 Answers

0
votes

I think that your issue is with avatar image, you should try to create separate table for that one and use: Parse documentation and connect it with the user.