UIImagePickerController - Remember last album - ios

My app allows users to pick images from Photo Library.
I use UIImagePickerController for this.
User may want to pick image from nested folders and finaly from particular album.
When user wants to pick another image again, the odds are good they will want to get image from the same album as previously.
Is there any way to instruct UIImagePickerController to show particular album (in this scenario the one from which previous image was loaded) when opening a new image ?
I found a similar question asked 10 years ago with negative answer, but since then maybe something have changed... [?]
Open UIImagePickerController to custom photo album?

Related

Prevent manual screenshot in IOS Objective-C

On iOS, my requirement is disallow user to take manual screenshot from my application, either disallow or blur the captured screenshot. How?
The only solution is to simulate the iOS controls you have in your View using DRM'ed videos.
For each widget you need to create a video subclass that renders the widget, and apply DRM to the video.
You can try to do it yourself, or use a commercial solution such as the following:
https://screenshieldkit.com
It is possible but I don't recommend it because of the room for error. It was easier to do in the past, in iOS13 you will have to do it like this:
You will have to ask for the user's permission to read and edit their photo library, then you have a listener which is checking the number of photos in their library while they are using your app, if that number changes, they have just taken a screenshot (unless you allow other things in your app like tap and hold to save image, etc). When this happens, read said photo and apply a blur, then delete the photo from their library and save the blurred photos.
Warning: There are times where a user may get a photo while using your app that is not a screenshot (e.g. they received an airdrop) and you will now be tampering with their photos, which is very bad. To prevent this you may need to use key value pixel encoding on your screen at all times, for example the first 3 pixels of the screen are 3 very specific RGB values, that way if a new photo is detected and the first 3 pixels are those exact RGB values you know it's a screenshot of your app and not just another photo that was somehow saved while the user was using the app.
There isn't any regular solution to your problem!
You can do some tricks such as if you force the user to have their finger on the screen for the image to show then I don't think they can create screenshots. Because as soon as you press the home+lock keys to actually take the screenshot, the screen seems to behave as if there are no fingers touching it.
BUT what if the user takes a screenshot by AssistiveTouch?!
OR what do you want to do if user records screen and taking screenshot from the video?
I think it's better to change your strategy for example notify the owner of picture for taking screen shot by another one (like SnappChat)!

iOS Image Viewer like Photo app

I am developing an app that has an internal gallery with some images.
What I want to achieve is exactly a result that behaves and looks like the Apple Photo app image viewer.
With a collection view I implemented the gallery images with thumbnails and now I would like to show the image on fullscreen on press.
The image viewer should have exactly the Apple's Photo behavior:
Full screen on single tap,
Delete, Share button etc...
Pinch to zoom, double tap zoom...
My question is. Is that really possible that such a common feature is not already given by iOS? Is there maybe a view controller already build in that we can use but I am not aware of?
I know there are some libraries around that make such thing, but I'm wondering if there's already something given.

Set image to the image view from Gallery without select the image from the Image Gallery

I am new to IOS app development. I have one problem. I have to get an image from the Image Gallery of the iPhone without letting the user select the image. I need to programatically set the image name of the image I need to get the Image. Any one please help me.
You can fetch images from Gallery programmatically using AssetLibrary.
These can be helpful Tutorial1 and Tutorial2
This stackoverflow answer could also be helpful
Once the images are fetch you can select and then set it to any UIImageView
Unfortunately what you'd like to do is not allowed on iOS.
You have to use UIImagePickerController, ask permission from the user, and let the user choose an image.
Check this thread: Access Photo Library via Objective-C/Xcode in iOS

Delete Images From iOS Photo Gallery [duplicate]

This question already has answers here:
ALAssetsLibrary delete ALAssetsGroup / ALAsset
(6 answers)
Closed 9 years ago.
I have created an Application that fetches Images from the photo library of the phone and displays it on a collection view.
Now, I want that whenever the user selects an image and click on a delete button that particular image gets deleted from the collection view as well as from the image library.
I am using ALAssetLibrary to fetch the images.
I searched a lot but did not find any way to delete the image from the photo library.
Can anybody tell me that how I can delete a photo from photo library programmatically from my application.
You can copy files from the gallery into your application's file system sandbox, where you can do anything you want with them. However, your application can't modify files outside the sandbox. This includes files in the gallery.
As this answer says, there doesn't appear to be a method defined for deleting photos there.

Is there any way to navigate to a specific photo album from UIImagePickerViewController?

I know it is possible to show ALL photo albums by setting the source of a uiimagepickerviewcontroller to UIImagePickerControllerSourceTypePhotoLibrary. However, is it possible to then navigate to a specific album if it exists?
No this cannot be.
Unfortunately,The UIImagePickerController is a private, system class, which doesn't really allow alteration.
You can not do this using UIImagePickerController but you can iterate through the gallery album.
Here is an example CustomPhotoAlbumDemo.

Resources