我如何从互联网上保存照片?

时间:2011-09-09 08:22:46

标签: iphone objective-c uiimage

我在该应用程序上创建了1个应用程序我正在使用json从flickr获取照片并将这些照片视为缩略图和幻灯片显示,如果假设用户想要保存一些来自flickr的照片怎么办我只是通过这样做NSDefaultManager无法正常工作,

    - (IBAction)saveImage
    {
        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,     NSUserDomainMask, YES);
        NSString *documentsDirectory = [paths objectAtIndex:0];
        NSString *savedImagePath = [documentsDirectory      stringByAppendingPathComponent: @"savedImage.png"];
        [imageData writeToFile:savedImagePath atomically:NO];   
    }

1 个答案:

答案 0 :(得分:0)

     try this code for the same//.


NSString *videoDocPath1 = [[NSString alloc] initWithString:[[[[NSBundle mainBundle]  resourcePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"Documents"]];
NSString *videofilePath1;
videofilePath1 = [videoDocPath1 stringByAppendingPathComponent:[NSString stringWithFormat:@"screensever.mp4"]]; 
[ScreenseverVideo writeToFile:videofilePath1 atomically:YES];