13

I have some possible results for How to open Photo App from uiviewcontroller in button Action. It's like a Facebook authentication screen open, that means when user click uibutton, it will minimize the native app and open the photo app. Is this possible for both ios 6 and ios 7 versions.

Kindly give some possible results if you are know?

If any body give the solutions I really appreciate to you.

Rafał Sroka
  • 39,540
  • 23
  • 113
  • 143
user1915959
  • 141
  • 1
  • 4
  • Which/What photo app ? – Maulik Mar 01 '14 at 14:00
  • @maulik default apple photos app. – user1915959 Mar 01 '14 at 14:02
  • 1
    Do you mean you want to get access to photo album? In that case you need to implement uipickercontroller and access the photo album there trough a view ( modal or pop up or any other kind) that way you can access the photo album. If you want to lunch another app from within your app then you have some answers below. – Adrian P Mar 01 '14 at 14:09
  • @XCodeMonkey What is `uipickercontroller`? Do you actually mean to use `UIImagePickerController`? It's important to be clear, especially when helping someone that is obviously new. – rmaddy Mar 01 '14 at 15:26
  • @user1915959 Why do you wish to launch the Photos app? Wouldn't it be better to allow the user to select a photo or take a picture with the camera without leaving your app? To do this you use `UIImagePickerController`. – rmaddy Mar 01 '14 at 15:27
  • @rmaddy, you are right. I did not completely put the method name. I was typing that on my iphone. It is indeed UIImagePickerController that I meant to mention. Thank you for the correction. – Adrian P Mar 01 '14 at 15:49

2 Answers2

43
UIApplication.shared.open(URL(string:"photos-redirect://")!)
Jigar Thakkar
  • 6,834
  • 2
  • 17
  • 15
5

It is not possible. The Photos app does not register any URL schemes. This means you cannot open it by calling the following method:

func open(_ url: URL, 
        options: [UIApplication.OpenExternalURLOptionsKey : Any] = [:], 
        completionHandler completion: ((Bool) -> Void)? = nil)

and passing a valid URL (like you would to open Safari or Phone apps). Short answer is that you cannot open the Photos app programmatically.

Documentation: About Apple URL Schemes

Rafał Sroka
  • 39,540
  • 23
  • 113
  • 143
  • 1
    In addition to this, you can check the next document for valid Apple URL schemes: https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html – Legoless Mar 01 '14 at 14:05
  • @reecon could you tell me What is the meaning about passing a valid URL? – user1915959 Mar 01 '14 at 14:05
  • @Legoless, good point. I updated my answer with the link for clarity. – Rafał Sroka Mar 01 '14 at 14:07
  • @user1915959, I updated my answer with a link to documentation about URL schemes you can use to open other apps. – Rafał Sroka Mar 01 '14 at 14:08
  • Photos App can be open using URL Schema, Here's the list of few URL Schema iOS supports [https://medium.com/@contact.jmeyers/complete-list-of-ios-url-schemes-for-apple-apps-and-services-always-updated-800c64f450f]. though as of now it's not possible to head into any specific Album or any other tab menu. – Mohit G. Dec 30 '21 at 14:06