title: Opening up facebook app page when button is pushed. Swift 5
body: <p>Facebook app wont open up, facebook in safari opens instead. Using xCode 10.2.1</p>
  
  <p>Deployment target running iOS 12.2</p>
  
  <p>Edit: this code does achieve the desired objective for Instagram</p>
  
  <p>Edit2: So on @bbrodsky's recommendation i changed "facebook" to "fb" in the URL link. The problem now is that it opens to my personal feed and not the business page i want it to open to.</p>
  
  <p>Edit3: So ive gotten it to work. Opens up the facebook app, and goes to desired page. Had to change the appURL to "fb://profile/NUMERICFBID". I was able to get the numeric facebook ID for the page at this site <a href="https://findmyfbid.com/" rel="nofollow noreferrer">https://findmyfbid.com/</a></p>
  
  <p>Tried solutions from this post and others. Cant seem to find any recent answers to this question, as everything seems to be from earlier versions of iOS and swift/xCode. Unsure if things have changed. Have added the recommended code to the plist source file with no results.</p>
  
  <p><a href="https://stackoverflow.com/questions/29902534/how-to-open-fb-and-instagram-app-by-tapping-on-button-in-swift">How to open fb and instagram app by tapping on button in Swift</a></p>
  
  <pre><code>@IBAction func facebookButtonTapped(_ sender: UIButton) {
     let screenName =  "MYSCREENNAME"
     let appURL = NSURL(string: "facebook://user?screen_name=\ 
       (screenName)")!
     let webURL = NSURL(string: "https://facebook.com/\ 
       (screenName)")!
  
     if UIApplication.shared.canOpenURL(appURL as URL) {
              if #available(iOS 10.0, *) {
                  UIApplication.shared.open(appURL as URL, options: 
              [:], completionHandler: nil)
              } 
              else { UIApplication.shared.openURL(appURL as URL)
              }
          } 
     else {
              //redirect to safari because the user doesn't have 
                Instagram
              if #available(iOS 10.0, *) {
                  UIApplication.shared.open(webURL as URL, options: 
                  [:], completionHandler: nil)
              } 
              else {UIApplication.shared.openURL(webURL as URL)
              }
          }
  </code></pre>
  
  <p>expected result is that the facebook app opens to the particular page. keep getting this error code. </p>
  
  <p>2019-06-08 11:28:39.561051-0500 SocialMediaLinkPractice[9888:2173963] -canOpenURL: failed for URL: "facebook://user?screen_name=MYSCREENNAME" - error: "This app is not allowed to query for scheme facebook"</p>