如下代码所示

点击按钮,将self.p_w_picpathView上面的p_w_picpath内容保存到本地相册,并指定判断保存成功与否的方法p_w_picpathSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:

- (IBAction)saveImageToAlbum:(id)sender {
    
UIImageWriteToSavedPhotosAlbum(self.p_w_picpathView.p_w_picpathself@selector(p_w_picpathSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:), nil);
}

实现p_w_picpathSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:方法

- (void)p_w_picpathSavedToPhotosAlbum:(UIImage *)p_w_picpath didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
    
NSString *message = @"成功";
    
if (!error) {
        message = 
@"成功保存到相册";
    }
else
    {
        message = [error 
description];
    }
    
NSLog(@"message is %@",message);
}

这些代码很简单,如果没有错误的话就提示“成功保存到相册”,如果保存失败的话,那么就输出错误信息[error description]。