简体   繁体   中英

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. 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

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. But if the app is installed it opens the share pop-up but don't include my URL. Sharing is working fine I need to include the URL to the share that I am passing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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