-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
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!
Metadata
Metadata
Assignees
Labels
No labels