PHAssetRequestChange deleteAsset does not delete Photo Stream asset as well - ios

In my app, the user can take a photo with a camera, and it will save the image to the camera roll via:
PHAssetChangeRequest creationRequestForAssetFromImage
I retrieve the PHAsset from this and keep a handle on it. Later on, the user is prompted to decide whether or not they want to delete the photo they took. Using
the handle on the PHAsset, I delete the PHAsset using:
[PHAssetChangeRequest deleteAssets:#[asset]];
I get the prompt "Allow 'MYAPP' to delete this photo?". And if you press delete, it deletes it from the camera roll.
However, if the user has Photo Stream enabled, the photo remains in the Photo Stream. Is there anything we can do to remove the Photo Stream image as well?

Hmm, I'm not sure offhand if Apple will allow us to do that or not, check out this post How to remove photos from iOS camera roll? - Maybe using their suggestion of creating your own camera and saving the file locally instead of in the camera roll so that you don't have to worry about the Photo Stream, then again we don't know the main purpose of your app so it's quite possible you want the photo to be in the Camera Roll.

Related

Capture high quality picture and record video without delay using NextLevel

Using the NextLevel library for image capture in iOS, I want to be able to take a high quality photo, or record a video at any given moment, but I can only take a photo if NextLevel.shared.captureMode == .photo and I can only take a video if NextLevel.shared.captureMode == .video. There's a delay and a callback after changing the setting.
So, the only thing I can think of is to change the mode whenever I want to capture a photo or capture a video. Then in the callback I would know whether I wanted to capture a video or take a photo based on the mode that it switched to, or some flag that I set.

How to get image from camera roll by name/identifier in Swift

in my app I'm taking a picture and save it in camera roll by:
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil)
Later in another screen, I want to display it to the user.
As I don't want to store the whole picture, is there any possibility to load an image from camera roll using the image name or an identifier? (And of course set the image name or saving the identifier when saving the picture)
Any help would be appreciated!
As per my knowledge it is not possible to load an image directly from camera roll using name/identifier.
For your requirement it is better to save your image with a name in document directory instead of saving it in camera roll, then load it with the same name where ever you want to use it.
For sample code refer #Dharmesh Kheni's answer in below link.
Get image name UIImagePickerController in Swift

Move instead of copy to PHPhotoLibrary

My iOS app records a video (in NSTemporaryDirectory()/...) and I want to save it to the camera roll.
This works fine but to save disk space I would like to move the file to the camera roll, not copy it. Is that possible?
Firstly you can save it to camera roll, then you can remove source file via removeItemAtPath:error method of NSFileManager when saving is completed.

How to preview automatically edited image after picking with UIImagePickerController

I my app users can take and save photos, but before I save them on disk, I have to compress and downscale them. Is it possible to show automatically edited image in a standard preview screen right after user captured the image with UIImagePickerController? Or should I build my own camera with AVFoundation? If so, could anyone suggest some lightweight opensource camera for my purposes?
You're going to have to build your own solution with AVCaptureSession, which is not hard, since you more than likely will want to keep the original photo in a temp file, compress it, show it on a custom view with an image view in it and then ask the user if they want to save it or not.
Here's Apple's Docs but there are plenty tutorials on how to do this

ALAssest of an Image taken from Camera without saving it

Hi I was wondering if theres a way to extract ALAsset of an image taken from Camera but without saving it...
Ive come across various example that used writeImageToSavedPhotosAlbum and then fetched the ALAssest, but i dont deem it necessary to save the image in the camera roll, was just wondering if this could be done otherwise
No ALAssest exists until the image has been successfully saved to the image library. Until then you just have a UIImage that has come from the picker. There is no mandate that the image needs to be saved into the library and any decision about whether you want to save the image should be based on what the app tells the user and if the user would naturally expect to find the image in the library after taking / saving it in the app.

Resources