SocialAccounts is an iOS framework that provides an easy way to manage social network accounts
- Xcode 4.5 or higher
- Apple LLVM compiler
- iOS 5.0 or higher
- ARC
Build and run the SocialAccountsExample
project in Xcode to see SocialAccounts
in action.
If you don't have CocoaPods installed, check section "Installation" below.
The recommended approach for installing SocialAccounts is via the CocoaPods package manager, as it provides flexible dependency management and dead simple installation.
Install CocoaPods if not already available:
$ [sudo] gem install cocoapods
$ pod setup
Edit your Podfile and add SocialAccounts
:
$ edit Podfile
platform :ios, '5.0'
pod 'SocialAccounts', :head
Install into your Xcode project:
$ pod install
Add #include "SocialAccounts.h"
to the top of classes that will use it.
SOAccountStore* store = [[SOAccountStore alloc] init];
SOAccountType* type = [store accountTypeWithAccountTypeIdentifier:SOAccountTypeIdentifierInstagram];
SOAccount* account = [[SOAccount alloc] initWithAccountType:type];
account.username = @"john";
SOAccountCredential* credential = [[SOAccountCredential alloc] initWithOAuth2Token:@"2342341.b6fw422.b8f5ffs9sjqljq7a70e788884b67c" refreshToken:nil expiryDate:nil];
credential.scope = @"relationships";
account.credential = credential;
[store saveAccount:account withCompletionHandler:^(BOOL success, NSError *error) {
NSLog(@"Saved Account");
NSLog(@"%@", [account description]);
}];
for (SOAccount* account in store.accounts) {
NSLog(@"loaded account %@", account.credential.oauthToken);
}