Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shu223/socialapihelpers

Twitter and Facebook API Helper classes for iOS using Social.framework
https://github.com/shu223/socialapihelpers

Last synced: about 2 months ago
JSON representation

Twitter and Facebook API Helper classes for iOS using Social.framework

Awesome Lists containing this project

README

        

Social API Helpers
======================

**Twitter and Facebook API Helper classes** for iOS using Social.framework. It works on iOS 6 or later.

##How to install

Add to Podfile.

```
pod 'SocialAPIHelpers', :git => 'https://github.com/shu223/SocialAPIHelpers'
```

##EXAMPLES: Authorization

###Request access to Twitter

Just call 1 method.

```
[TTMAccountHelper requestAccessToTwitterAccountsWithHandler:^(NSError *error) {
}];
```

###Request access to Facebook

Create a dictionary for options (permissions) and call the request method.

```
NSDictionary *options = [TTMAccountHelper optionsToReadStreamOnFacebookWithAppId:kFacebookAppId];

[TTMAccountHelper requestAccessToAccountsWithType:ACAccountTypeIdentifierFacebook
options:options
handler:^(NSError *error) {
}];
```

###Multi-account support

```
NSArray *accounts = [TTMAccountHelper twitterAccounts];

if ([accounts count] >= 2) {

[TTMAccountHelper showAccountSelectWithDelegate:self
inView:self.view];
}
```

##EXAMPLES: Access to Twitter API

###Getting user information

####Me

```
[TTMTwitterAPIHelper userInformationForAccount:account
handler:
^(id result, NSError *error) {

NSLog(@"result:%@, error:%@", result, error);
}];
```

####Other users

```
[TTMTwitterAPIHelper userInformationWithScreenName:screenName
account:account
handler:
^(id result, NSError *error) {

NSLog(@"result:%@, error:%@", result, error);
}];
```

###Read Timeline

####Home

```
[TTMTwitterAPIHelper homeTimelineForAccount:account
handler:
^(id result, NSError *error) {

NSLog(@"result:%@, error:%@", result, error);
}];
```

####User

```
[TTMTwitterAPIHelper userTimelineWithScreenName:@"shu223"
account:account
handler:
^(id result, NSError *error) {

NSLog(@"result:%@, error:%@", result, error);
}];
```

##EXAMPLES: Access to Facebook API

###News Feed

```
[TTMFacebookAPIHelper newsfeedForAccount:account
handler:
^(id result, NSError *error) {

NSLog(@"result:%@, error:%@", result, error);
}];
```

###Friends

```
[TTMFacebookAPIHelper friendsForAccount:account
handler:
^(NSArray *friends, NSDictionary *result, NSError *error) {

NSLog(@"friends:%@, result:%@", friends, result);
}];
```

One of returning value `frineds` is an array of "[TTMFacebookProfile](https://github.com/shu223/SocialAPIHelpers/blob/master/SocialAPIHelpers/TTMFacebookProfile.h)" objects.