我想将图像保存到 iphone sdk 的照片库中。我的图片来自一个网址,而该网址来自 APNS。基本上,当用户单击作为推送通知出现的 URL 时,我想直接将图像保存到 iphone lib 中而不打开应用程序。现在我这样做如下,但我不想显示我只想保存的图像。
-(void) sshowansimage:(NSString *) strImageURL
{
NSURL *imageURL = [NSURL URLWithString:strImageURL];
NSLog(@"coming URL is %@", strImageURL);
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
NSData *imageData = [NSData dataWithContentsOfFile:strImageURL];
[self performSelectorOnMainThread:@selector(showImage:) withObject:imageData waitUntilDone:YES];
});
}
-(void)showImage:(NSData*)imageAsData
{
NSLog(@"IN image view mthhod data is %d",imageAsData.length);
ansinage.image = [UIImage imageWithData:imageAsData];
}