Hi in my application I have image which change every day as per the date now i want to give download option for the user like they have to download by clicking button and they can see in there device. I'm searching for long time to achieve this task but not able get the proper solution please tell me how to achieve this one.
My ImageView code.
- (void)viewDidLoad
{
[super viewDidLoad];
//this is url which gives the date has a echo
NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"url"]];
[request setHTTPMethod:@"GET"];
[request setValue:@"application/json;charset=UTF-8" forHTTPHeaderField:@"content-type"];
NSError *err;
NSURLResponse *response;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
NSString *resSrt = [[NSString alloc]initWithData:responseData encoding:NSASCIIStringEncoding];
//This is for Response
// here I'm connecting the date to my url do display the image
NSString *imgstr=[NSString stringWithFormat:@"url",resSrt];
//assign your image view name
imageview.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",imgstr] ]]];
}
I have used the above to do display the image now to want to user download the image by clicking the download button to localstorage of the device please tell me how to achieve this.
Thanks.