Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] While passing the LinkedIn profile url to open the LinkedIn profile in LinkedIn app, it's opening in web #27

Open
swarna456 opened this issue Feb 26, 2024 · 0 comments

Comments

@swarna456
Copy link

swarna456 commented Feb 26, 2024

I want to open the profile of LinkedIn in LinkedIn app if app is installed otherwise in web. So, I added the code like this:

if let linkedIn = "https://www.linkedin.com/in/prakashiyerleadershipcoach" {
                            guard let linkedInAppURL =  URL(string: "linkedin:\(linkedIn)")
                            else { fatalError(Localize.validUrlExpectedMsg) }
 UIApplication.shared.open(linkedInURL, options: [:], completionHandler: nil)
                        }

Always it's redirecting to web only even if the app is installed.

I tried to resolve this issue using deep linking

let linkedIn = "https://www.linkedin.com/in/prakashiyerleadershipcoach"
            guard let linkedInAppURL =  URL(string: "linkedin://profile/prakashiyerleadershipcoach")
            else { fatalError("Invalid linkedInAppURL") }
            guard let linkedInWebURL = URL(string: (linkedIn.removingPercentEncoding)!)
            else { fatalError("Invalid linkedInWebURL") }
            if UIApplication.shared.canOpenURL(linkedInAppURL) {
                UIApplication.shared.open(linkedInAppURL)
                print("linkedinnnnn == \(linkedInAppURL)")
            } else {
                UIApplication.shared.open(linkedInWebURL, options: [:], completionHandler: nil)
                print("linkedinnnnn == \(linkedInWebURL)")
            }
}

Added LSApplicationQueriesSchemes in info.plist file

    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>linkedin</string>
    </array>

Now while clicking on link profile page is opening in app if app is installed otherwise opening in web.
But this is not the official URL schemes provided by linkedIn. I need the permanent solution for that. Can anyone help me in that. Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant