我需要在LinkedIn应用程序中打开我的iOS应用程序中的一个公司网址。我试过用URL Scheme来做这件事,但我还没有做到。
这段代码打开了LinkedIn应用程序,但在我需要的url中没有打开:
UIApplication.sharedApplication().openURL(NSURL(string: "linkedin://profile/xxx_id_company_xxx")!)有谁可以帮我?
发布于 2018-01-14 17:39:13
Swift 4
在info.plist下面的LSApplicationQueriesSchemes添加
<string>linkedin</string>, then in your code just add
let webURL = URL(string: "https://www.linkedin.com/in/yourName-yourLastName-yourID/")!
let appURL = URL(string: "linkedin://profile/yourName-yourLastName-yourID")!
if UIApplication.shared.canOpenURL(appURL) {
UIApplication.shared.open(appURL, options: [:], completionHandler: nil)
} else {
UIApplication.shared.open(webURL, options: [:], completionHandler: nil)
}发布于 2015-05-12 15:17:22
似乎正确的格式是"linkedin://companyName/companyId“
请看这个问题:How can open LinkedIn Comapny Url in iPhone app programmatically?
发布于 2015-10-03 16:50:04
这个linkedin公司网址计划正在为我工作
这个目标c代码尝试在linkedin应用程序中打开linkedin公司页面,然后回到呈现公司网页的模式web视图中。
/* try to open linkedin app with company url */
if (![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"linkedin://company?id=2589010"]]) {
/* Unable to open linked app, present web page with url @"https://www.linkedin.com/company/sesli-sozluk" */
...
}您可以在linkedin上的公司页面源代码中找到您的“公司id”。搜索"company-id“或"companyId",它在一个隐藏的输入字段中。
https://stackoverflow.com/questions/30194780
复制相似问题