当我尝试在解析中更新用户详细信息 时,有时我在保存用户详细信息时遇到错误。
这样的错误:
错误域= NSURLErrorDomain代码= -1021"请求正文流耗尽" UserInfo = {NSUnderlyingError = 0x7fd62c4aa980 {错误域= kCFErrorDomainCFNetwork代码= -1021"请求正文流耗尽" UserInfo = {NSErrorFailingURLStringKey = http://files.parsetfss.com/,NSLocalizedDescription =请求正文流耗尽,NSErrorFailingURLKey = http://files.parsetfss.com/}},NSErrorFailingURLStringKey = http://files.parsetfss.com/,NSErrorFailingURLKey = http://files.parsetfss.com/,NSLocalizedDescription =请求正文流耗尽}
这是我的代码:
- (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;
}
}
}];
}
我在谷歌上搜索了解这类问题的主要原因。
有人可以帮我解决这个问题吗?在此先感谢。