Social networking has become an integral part of our lives these days and many mobile apps take advantage of that by offering users a variety of social-networking features. From allowing users to log in with their existing Facebook or Twitter accounts, to providing standalone social networking mobile clients, there are countless apps out there with social networking integration.
Today, I'd like to discuss some ways for iOS developers to integrate these services with their apps. Also, I’ll show you how to implement a custom interface for a list of social networks using the ShareKit framework.
Ways to integrate mobile apps with social networks
Apple Inc. is well aware of how important social networking integration is, so they have already added some social networking support (first Twitter support and later Facebook support) to iOS. Yet, considering the growing number of general and specialized social networks, iOS developers often wish that Apple would offer the integration tools a bit quicker. At the moment, developers have to spend quite some time, exploring the SDK of each social network, as well as creating an interface.
However, in some cases it's easier and more effective to use a all-in-one solution, like ShareKit. This framework allows developers to integrate more than 10 social networks, including VKontakte — one of the most popular social networks in Russia — into iOS apps comparatively quickly and easily.
This framework offers a couple of user-friendly features. For instance, the framework ‘remembers’ user's choice and sorts the list of services by frequency of use, filters the list by types of objects the user wants to share, allows to schedule a post if there is no Internet connection and much more.
Despite the framework’s abundance of cool features, the native interface is quite ascetic: it generates the Choose Service menu using a UIActionSheet-based class.
Design is what all recent applications (not to mention iOS 6 default data processing UIActivityViewController interface) bet on when trying to attract users. Although the recent revelations of iOS 7 have added quite an ambiguous connotation to this notion. Anyway, today I'd like to share my experience in customizing a ShareKit standard list.
As usual, app development can be divided into 2 parts:
- Interface — we decide to implement everything according to the original idea of the designer or client.
- Code — we add the ShareKit framework the usual way, following developer's recommendations.
Then, add the import of the following classes to the controller, where we plan to use the framework:
#import "SHK.h" #import "SHKItem.h" #import "SHKSharer.h"
In the method we need we add:
//create an object we'd like to share SHKItem *item = [SHKItem image:image title:_child.name]; // create a sharer SHKSharer* sharer = [[NSClassFromString(@"SHKVkontakte") alloc] init]; //pass the object to the sharer [sharer loadItem:item]; // finally share : ) [sharer share];
From that moment on, the framework would manage the task all by itself, if all social network accounts are well configured. For Facebook and Twitter either their native iOS interface will be applied if the iOS version allows, or SDK of these networks.
The main types of objects:
You can find the list of sharers in the folder:
Something to consider
ShareKit developers warn not to modify the framework too much. For example, one of the native iOS lists can sort services by frequency of use, while if modified this feature could disappear or require some extra efforts to start functioning. Besides, in some cases adding support for checking service availability might be required: for example if the Instagram app, which is used by the framework through an URL scheme, is installed.
Considering the above, I'd recommend that before you jump to implementation, first check all the pros and cons of the chosen solution, learn other options, and then take the one that fits your project best.
Good luck with integration!