You want to be able to allow your users to share content inside your apps with their friends, through an interface similar to that shown in Figure 2-35, using different sharing options available in iOS, such as Facebook and Twitter.
Figure 2-35. The activity view controller displayed on an iOS device
Create an instance of the
UIActivityViewController class and share your
content through this class, as we will see in the Discussion section of
The instances of
UIActivityViewController must be presented modally on the iPhone and inside a popover
on an iPad. For more information about popovers, refer to Recipe 2.27.
There are many sharing options inside iOS 6, and all are built into the core of the OS. For instance, Facebook and Twitter integration is now an integral part of the core of iOS and you can share pretty much any content from anywhere you want. Third-party apps like ours can also use all the sharing functionalities available in iOS without having to think about the low-level details of these services and how iOS provides these sharing options. The beauty of this whole thing is that you mention what you want to share and iOS will pick the sharing options that are capable of handling the items that you want to share. For instance, if you want to share images and text, iOS will ...