0

I've got code working that opens the Facebook app to a specific page when a button is clicked. This one particular page Im opening is a business site and contains both the 'posts' and 'visitor posts' subsections. I can manually navigate to these sections in the facebook app after tapping the button in my app, but I'm hoping theres a way to have the facebook app open the 'posts' or 'visitor posts' section automatically.

This is the code that works to open the Facebook app to the page:

@IBAction func openFBPage(_ sender: Any) {
        if let url = URL(string: "fb://profile/157299717658"){ ...

If I try something like this to get to the 'posts' subsection, the Facebook app still opens but goes to the users timeline instead of the business page:

@IBAction func openFBPage(_ sender: Any) {
            if let url = URL(string: "fb://profile/157299717658/posts"){ ...
rmaddy
  • 314,917
  • 42
  • 532
  • 579
Will Buffington
  • 1,048
  • 11
  • 13

1 Answers1

0

Well, I did figure out that what I'm looking for is called a URL Schema (scheme). Unfortunately there isn't a comprehensive list of available schemas that I can find that will work. Many of the schemas used in the past have apparently been deprecated and will not work or will only open the Facebook app but land the user on their own profile page.

There's a pretty comprehensive posting on Stack Overflow HERE but again not all of these are working. In fact, so far the only one I can get to work is

fb://profiles/[facebookID]

I'll keep searching and working with schemas and update my answer if I find something that works, but for now, URL schemes are the answer.

Will Buffington
  • 1,048
  • 11
  • 13