简体   繁体   English

通过iOS应用在LinkedIn上共享URL

[英]Share an URL on LinkedIn from an iOS app

I am developing a iOS app in that I need to share URL on linkedIn When user taps share button my app's URL should be shared. 我正在开发一个iOS应用程序,因为我需要在linkedIn上共享URL。当用户点击共享按钮时,我的应用程序的URL应该被共享。 If the LinkedIn app is installed sharing should be via app and if app is not installed user should be able to share vis safari.Below is my code 如果安装了LinkedIn应用程序,则应通过应用程序共享;如果未安装应用程序,则用户应能够与Safari共享。以下是我的代码

if (![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"linkedin://shareArticle/mini=true&url=http://code.tutsplus.com/tutorials/ios-sdk-working-with-url-schemes--mobile-6629"]]) {

        // opening the app didn't work - let's open Safari
        if (![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.linkedin.com/shareArticle?mini=true&url=http://code.tutsplus.com/tutorials/ios-sdk-working-with-url-schemes--mobile-6629"]]) {

            // nothing works - perhaps we're not only
            NSLog(@"LinkedIn doesn't works. Punt.");
        }
    }

This is working perfectly fine when the app is not installed user is redirected to safari and my app's URL is included. 当未安装该应用程序的用户被重定向到safari并且包含我的应用程序的URL时,这工作得很好。 But if the app is installed it opens the share pop-up but don't include my URL. 但是,如果安装了该应用程序,它将打开共享弹出窗口,但不包含我的URL。 Sharing is working fine I need to include the URL to the share that I am passing. 共享工作正常,我需要包含要传递的共享的URL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM