Ios 网络映像未存储在缓存中?
我正在使用AFNetworking从PhotoLibaray和照相机上传图像到我的服务器上。图像已成功上载到我的服务器上。之后还使用AFNetworking获取了所有图像。但在获取所有图像时,我从未存储在缓存中的相机上载了图像。只有PhotoLibrary图像存储在缓存中 使用相机或照片库上传图像Ios 网络映像未存储在缓存中?,ios,iphone,afnetworking,Ios,Iphone,Afnetworking,我正在使用AFNetworking从PhotoLibaray和照相机上传图像到我的服务器上。图像已成功上载到我的服务器上。之后还使用AFNetworking获取了所有图像。但在获取所有图像时,我从未存储在缓存中的相机上载了图像。只有PhotoLibrary图像存储在缓存中 使用相机或照片库上传图像 -(void)UploadImage { NSString *stringUrl = @"My_Url"; NSString *User_Id = [[AppDelegate ge
-(void)UploadImage
{
NSString *stringUrl = @"My_Url";
NSString *User_Id = [[AppDelegate getdefaultvalue] valueForKey:@"User_Id"];
NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:User_Id,@"id",Str_FestName,@"F_Name",Str_FestWeather,@"F_Weather",Str_FestSize,@"F_Size",Str_FestLoc,@"F_Location",Str_FestDate,@"F_Date",Str_FestDisctrpt,@"F_Discription", nil];
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
NSLog(@"file path ==%@",[[AppDelegate getdefaultvalue] valueForKey:@"LocalPath_Fest"]);
if ([[[AppDelegate getdefaultvalue] valueForKey:@"LocalPath_Fest"] length] == 0)
{
[MBProgressHUD hideHUDForView:self.view animated:YES];
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"FestEvo" message:@"Please Select image" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:Nil, nil];
[alert show];
[[[AppDelegate sharedinstance] window] setUserInteractionEnabled:YES];
}
else
{
NSURL *filePath = [NSURL fileURLWithPath:[[AppDelegate getdefaultvalue] valueForKey:@"LocalPath_Fest"]];
//NSURL *filePath = [[AppDelegate getdefaultvalue] valueForKey:@"LocalPath"];
NSLog(@"file path ==%@",filePath);
// NSURL *filePath = [NSURL fileURLWithPath:self.localFilePath];
[manager POST:stringUrl parameters:parameters constructingBodyWithBlock:^(id<AFMultipartFormData> formData)
{
[formData appendPartWithFileURL:filePath name:@"userfile" error:nil];
}
success:^(AFHTTPRequestOperation *operation, id responseObject)
{
[MBProgressHUD hideHUDForView:self.view animated:YES];
[[[AppDelegate sharedinstance] window] setUserInteractionEnabled:YES];
NSLog(@"Success: %@", responseObject);
NSString *Resp = [[[[responseObject valueForKey:@"Root"] objectAtIndex:0] valueForKey:@"Record"] valueForKey:@"message"];
alert_Success = [[UIAlertView alloc]initWithTitle:@"FestEvo" message:Resp delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:Nil, nil];
[alert_Success show];
}
failure:^(AFHTTPRequestOperation *operation, NSError *error)
{
[MBProgressHUD hideHUDForView:self.view animated:YES];
[[[AppDelegate sharedinstance] window] setUserInteractionEnabled:YES];
NSLog(@"Error: %@", error);
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"FestEvo" message:[error localizedDescription] delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:Nil, nil];
[alert show];
}];
}
}
并在imageview中设置图像
[imageView setImageWithURL:[NSURL URLWithString:[[[self.Ary_AllFest objectAtIndex:indexPath.row] valueForKey:@"Record"] valueForKey:@"image"]];
但只有照片库图像存储在缓存中,而不是相机图像
[imageView setImageWithURL:[NSURL URLWithString:[[[self.Ary_AllFest objectAtIndex:indexPath.row] valueForKey:@"Record"] valueForKey:@"image"]];