// 获取 图片类型的上下文
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, NO, 0);
// 获取当前上下文
CGContextRef ctx = UIGraphicsGetCurrentContext();
// 截屏
[self.view.layer renderInContext:ctx];
// 取图片
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
// 关闭图片类型的上下文
UIGraphicsEndImageContext();
// 保存到相册
UIImageWriteToSavedPhotosAlbum(image, NULL, NULL, NULL);
添加plist字段 NSPhotoLibraryAddUsageDescription