How to delete photos from iphone without removing from icloud - ios

To delete photo from iphone, I am using below function:
PHAssetChangeRequest.deleteAssets(asset)
But when I call it to delete photo, a dialog (this photo will be deleted from icloud photo library on all your devices) will be displayed.
However, I don't need this dialog. I only want to delete photos from iphone and not display above dialog.
How can I do it?
Please see below my capture screen.

Related

How to hide iCloud images in picker while picking image from photos using Photos Framework

In my app, I am allowing the user to select photos from the album, but here I want to hide iCloud images for selection. I found this solution but not working for me, the iCloud image is visible to select. Picker should show local images and camera roll images for selection.
I tried below AssetCollection subtypes:
PHAssetCollectionSubtypeAlbumMyPhotoStream : found iCloud image PHAssetCollectionSubtypeSmartAlbumUserLibrary: found iCloud image
Any idea how to do that? Which PHAssetCollectionSubtype should have to use?
What do you mean exactly with iCloud images?
There is the iCloud Photo-Library. The images are just normal assets in the All Photos album. There is no way to hide them as the iCloud Photo Library does not differantiate between what's on the device and what's in the Cloud. The only thing you can do is prevent network access (cloud download), when you request the full resolution image/data, video data for the asset.
There are "Shared Photostreams and "My Photostream". These are not part of "All Photos" and in separate albums. These you can just exclude by not including the albums in the interface

How can I show only one album which is created on my app in Swift?

I want to show users only picture/video taken in my app on camera roll.
So, when user click gallery button, my app only show "my app" album.
Is this possible ?
You can do one thing
When you save your picture captured by your camera, you can save then specific folder like "AppName-Photos" so each photos save in that particuler folder and when you retrive album just take only photos when there is album name "AppName-Photos" and ignore others
To save photos to your own custom album you can refer this link : iOS save photo in an app specific album
To Fetch only custom album photos you can refer this link: iPhone : Photos framework : how to get only those album/images which created by my app only not by others?

Is there any way a user could save images to my app from safari as they can do with the native camera roll app?

On an iphone, if you hold down on an image while in safari, a diaglog pops up asking you if you want to save or copy the image. If saved, the image is downloaded straight to your camera roll. If I wanted the user to save images to my app as conveniently as they are saved to the camera roll from safari, how would I go about doing that?
You should be able to set up your app as being able to open image files of the desired types (.jpg, .png, etc) by adding the appropriate settings to your info.plist, and that should cause the system to add an "open in" item to the sharing dialog in Safari.

Save image to app album with UIActivityViewController

I am using UIActivityViewController to share and save images in my app. Right now, images get stored in global Camera roll. I want to save it to app's own album.
To do that, I had to exclude UIActivityTypeSaveToCameraRoll from UIActivityViewController and add my own custom SaveImageActivity. Now problem is that the activity comes at the last. How do I change the order to bring my custom UIActivity to the front?
Similar queries show that this is not possible to do. How is Dropbox app able to do it then?

How can I access the photo library in iOS?

Is there any way to jump into photo library ?
I'm not asking about UIImagePicker.
In original camera app of iPhone, when I touch a thumbnail of one of the last photos (at the bottom left corner), it goes into photo library (actually, camera roll).
Is that private API or can i use it somehow? Well, I think I can implement that using ALAsset but I'm just wondering if there is any API
I believe you can launch the photo app, in order to view it as you would normally. However you cannot return to your app after launching the photo library.
You'll need to launch com.apple.camera

Resources