diff --git a/PhotoTweaks/PhotoTweaks/PhotoTweaksViewController.m b/PhotoTweaks/PhotoTweaks/PhotoTweaksViewController.m index 3ff0d53..a38c49d 100644 --- a/PhotoTweaks/PhotoTweaks/PhotoTweaksViewController.m +++ b/PhotoTweaks/PhotoTweaks/PhotoTweaksViewController.m @@ -10,6 +10,7 @@ #import "PhotoTweakView.h" #import "UIColor+Tweak.h" #import +#import @interface PhotoTweaksViewController () @@ -115,7 +116,19 @@ - (void)saveBtnTapped CGImageRelease(imageRef); if (self.autoSaveToLibray) { - UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:finishedSavingWithError:contextInfo:), nil); + __block PHObjectPlaceholder *placeholder; + + [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{ + PHAssetChangeRequest* createAssetRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:image]; + placeholder = [createAssetRequest placeholderForCreatedAsset]; + + } completionHandler:^(BOOL success, NSError *error) { + if (success) { + NSLog(@"didFinishRecordingToOutputFileAtURL - success"); + } else { + NSLog(@"%@", error); + } + }]; } [self.delegate photoTweaksController:self didFinishWithCroppedImage:image];