People expect to have access to their favorite social media accounts regardless of their current context. iOS makes it easy to integrate social media interactions into your app in ways that people appreciate.
Give users a convenient way to compose a post without leaving your app. As much as possible, you want to integrate social media support into your app so users can post content to their account without switching to another app to do so. The Social framework provides a compose view controller that allows you to present users with a view in which they can edit a post. Optionally, you can prepopulate the compose view with custom content before you present it to users for editing (after you present the view to users, only they can edit the content). To learn about the programming interfaces of the Social framework—including the
SLComposeViewController class—see Social Framework Reference.
When possible, avoid asking users to sign into a social media account. The Social framework works with the Accounts framework to support a single sign-on model, so you can get authorization to access the user’s account without asking them to reauthenticate. If the user hasn’t already signed into an account, you can present UI that allows them to do so.
Consider using an activity view controller to help users choose one of their social media accounts. By default, an activity view controller—that is, a
UIActivityViewController object—lists several system-provided services that act upon the currently selected content, including sending the content via Mail or Messages and posting the content to social media accounts. When you use an activity view controller, you don’t have to provide a custom service that interacts with a social media account and you benefit from the user’s familiarity with the Share button that reveals the list of services. For guidelines on how to use an activity view controller in your app, see Activity View Controller.