Upload image to app (Camera / Photo Library) Swift

Hi all,

I've been trying a lot of solutions online for quite some time, but I haven't had much luck at all.

I have a button that presents an alert with two options: Photo Library or Camera.
When Photo Library is pressed, I'd like a photo library picker to display so the user can pick a single image.
When Camera is pressed, I'd like a camera view to appear so the user can take a single image.

Then, I'd like that image to be saved to the device, and the function should return the location URL so I can integrate that into my dictionary (see my earlier post here).

As I say, I've tried quite a lot and I haven't managed to get it working. If anyone could help, I'd be hugely grateful.

Thank you all so much in advance, and I hope you're all doing well during this time!

Replies

Did you try UIImagePickerController.InfoKey.imageURL?