Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. void _ScreenshotWriteToAlbum(const char* path) {
  2. UIImage *image = [UIImage imageWithContentsOfFile:[NSString stringWithUTF8String:path]];
  3.  
  4. ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
  5. NSMutableDictionary *metadata = [[NSMutableDictionary alloc] init];
  6.  
  7. [library writeImageToSavedPhotosAlbum:image.CGImage metadata:metadata completionBlock:^(NSURL *assetURL, NSError *error) {
  8. if (error) {
  9. NSLog(@"Screenshot error - %@", error);
  10. } else {
  11. NSLog(@"Screenshot taken - %@", assetURL);
  12. }
  13. }];
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement