The LinkedIn sharing functionality in the ShareBoxController is non-functional on iOS 11 and later versions.
The root cause of this issue is the use of deprecated and removed APIs for LinkedIn sharing through the Social framework.
- The code attempts to use
SLComposeViewController
withSLServiceTypeLinkedIn
:
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeLinkedIn]) {
SLComposeViewController *shareBoxComposer = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeLinkedIn];
// ...
}
-
Apple deprecated and removed support for LinkedIn sharing via the Social framework in iOS 11.
-
As a result,
[SLComposeViewController isAvailableForServiceType:SLServiceTypeLinkedIn]
will always returnNO
on iOS 11 and later, preventing the LinkedIn sharing functionality from working. -
The fallback code assumes that LinkedIn is not configured on the device, which is incorrect:
} else {
// LinkedIn is not configured on the device, show an alert
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"LinkedIn Account" message:@"Please configure a LinkedIn account in your device settings to share on LinkedIn." preferredStyle:UIAlertControllerStyleAlert];
// ...
}
Users on iOS 11 and later versions are unable to share content to LinkedIn using this feature. They receive a misleading error message suggesting that LinkedIn is not configured on their device, even if it is.
-
Remove the deprecated LinkedIn sharing code using
SLComposeViewController
andSLServiceTypeLinkedIn
. -
Implement an alternative sharing method:
- Use the official LinkedIn API and SDK for iOS.
- Implement a web-based sharing solution using a web view or by opening the LinkedIn app (if installed) with a custom URL scheme.
- Use a more general sharing method like
UIActivityViewController
, which allows users to choose from available sharing options on their device.
-
Update the error handling to provide more accurate information to users about the availability of LinkedIn sharing.
-
Consider implementing a more flexible sharing architecture that can adapt to changes in social media platform APIs and policies.
By addressing these points, the ShareBoxController can provide a more reliable and future-proof LinkedIn sharing experience for users across different iOS versions.