0

on a webview with this custom scheme type:

case "whatsapp":
     #if DEBUG
      print("this is whatsapp")
     #endif
     openCustomApp(urlScheme: "whatsapp://", additional_info: url_elements[1])
            decisionHandler(.cancel)

how can I adapt this to facebook?

I tried to replace whatsapp:// with fb:// and in plist at LSApplicationQueriesSchemes I set string to fb

It still opens a url in safari.

Jay
  • 686
  • 1
  • 4
  • 16
Andrei M.
  • 1
  • 2
  • Can you try with full URI scheme as such fb://MODULE_NAME, you can find all supported modules in this answer https://stackoverflow.com/a/30231726/1244597, for example, fb://recent_feed to open the "most recent" page that I prefer over the home feed )) – AamirR Oct 12 '17 at 21:04
  • Can u post how you added `LSApplicationQueriesSchemes`? – Vini App Oct 13 '17 at 22:37

1 Answers1

0

I believe you can't just open the facebook app, you need to pass a parameter for a profile or page id like:

fb://profile/<id>

and for pages it's:

fb://page/<id>

You can test if the device is able to open a specific url using:

UIApplication.shared.canOpenURL(URL(string: "fb://"))
ahbou
  • 4,710
  • 23
  • 36
  • indeed, I have the url on the page that the webview is loading, it is fb://profile/ as in fb://profile/5550296508 (CNN) and it doesn't work. – Andrei M. Oct 12 '17 at 21:41