1

I am able to save Image/Video to Camera Roll in album using method UIImageWriteToSavedPhotosAlbum/UISaveVideoAtPathToSavedPhotosAlbum respectively.

Now I want to add image to Favorites in Album, how can I add image/video here?

Please help, thanks in advance.

Asif Raza
  • 720
  • 10
  • 25

1 Answers1

0

I resolved it using Photos framework. PHAssetChangeRequest has a property isFavorite. You can set true as mentioned in below code: -

Swift 3:

PHPhotoLibrary.shared().performChanges({
    let request = PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: self.videoWatermarkedURL!)
    request?.isFavorite = true
}) { saved, error in
    if saved {
        OperationQueue.main.addOperation({
            UIAlertController.sharedInstance().showAlert(withTitle: AMTSavezees, message: "Video Saved in Favorite!", autoHideDuration: 3)
        })
    }
}

Good luck.

Ashley Mills
  • 41,127
  • 14
  • 115
  • 144
Asif Raza
  • 720
  • 10
  • 25