Introducing Phonegap/Cordova iOS Social Plugin
By Emily Newsom
We've been using Phonegap/Cordova for a number of cross platform apps lately and have found that we are really starting to take advantage of a lot of native plugins. One of the latest features we were looking to integrate was that of social sharing--namely, sharing items to one's Facebook, Twitter, Instagram etc account from the app.
On iOS, each social site (Twitter, Facebook, etc) tends to provide its own app and its own libraries in order to allow 3rd party integrations, but starting with iOS 6 Apple has followed Android's lead and integrated social functionality right into the OS itself. The benefit of the iOS social integration is that using the social features from an app is a breeze--you deal with a single api and iOS handles everything for you.
What about Phonegap/Cordova?
Now on Phonegap there is currently a ShareKit plugin. ShareKit is a social sharing toolkit that works on iOS 4.2+ (I believe) and supports a ton of sites that Apple would never integrate into iOS. ShareKit will also use the iOS social functionality if it detects iOS6. Sounds good right? Well if you've ever taken a look at ShareKit you will quickly realize it is quite the beast! For example, adding the ShareKit dependency to my last app instantly doubled its size.
So what's the alternative to ShareKit on Phonegap? Well if you're OK not supporting sharing pre-iOS6 and you want a lightweight solution, take a look at the new lightweight Social plugin that we just wrote and commited to Phonegap's github repo.
The Phonegap/Cordova iOS Social plugin
The iOS Social plugin is part of Phonegap: https://github.com/phonegap/phonegap-plugins/tree/master/iOS/Social
The actual repo is hosted here with more information: https://github.com/bfcam/phonegap-ios-social-plugin