1

I am looking with below code we are able to open facebook or twitter iOS app but is there a way to do it for Patreon App ?

    let appURL = NSURL(string: "fb://profile/\(facebook)")!
    let webURL = NSURL(string: "https://www.facebook.com/\(facebook)")!
    let application = UIApplication.shared

    if application.canOpenURL(appURL as URL) {
        application.open(appURL as URL)
    } else {
        application.open(webURL as URL)
    }

I also included on Info.plist the below lines:

<array>
    <string>instagram</string>
    <string>fb</string>
</array>

Would you please help me by letting me know how to also add Patreon App on info.plist?

2 Answers2

1

I´m writing this comment in order to let you know i discover the solution yesterday:

let webURL = NSURL(string: "https://www.patreon.com/\(patreonUserName)")!
let application = UIApplication.shared

    application.open(webURL as URL)

This solved my issue and i discovered just by lucky :)

Best Regards.

0

Try with the following code

In the Plist file, add the following -

<string>com.patreon.iphone</string>

Now call from app as you call like FB. I have tested in updated Xcode (11.4 and swift 5.x) using the below code which is working fine -

func open(scheme: String) {
      if let url = URL(string: scheme) {
        UIApplication.shared.open(url, options: [:], completionHandler: {
          (success) in
          print("Open \(scheme): \(success)")
        })
      }
    }

Call:

self.open(scheme: "com.patreon.iphone://")

Note: Not all app has the Url schema. If you need to know URL schema, download the IPA and see the plist file of the 3rd party app using this Apple Configurator 2. Here is a helpful link.

Razib Mollick
  • 4,617
  • 2
  • 22
  • 20