6

Iam implementing facebook and twitter using sharekit for an iphone app. How can we get the user id of the logged in user so that I could send it to the server. Any help will be greatly appreciated. Thank you.

isarathg
  • 858
  • 1
  • 19
  • 37

5 Answers5

1

Did you try Step 3 of the installation for Sharekit?

Step 3: Filling in API Keys

Most of the web services that ShareKit integrates require you to use an API key when connecting. An API key is a unique identifer that tells the service what app is making the request.

You have to sign up for each api key, but they are all free and sign-ups are quick.

Locate and open the file SHKConfig.h, just inside the ShareKit group in your project's file list.

At the top you'll find a list of services that require api keys. Each service has a link next to it. Follow the link for each service to get an api key. Fill in the api key for each corresponding service within SHKConfig.h.

Note: Follow the comments within the SHKConfig file, they provide additional steps and possible customizations for each service.

For the full documentation see http://www.getsharekit.com/install/ and http://www.getsharekit.com/docs/

stackr
  • 2,742
  • 27
  • 44
1

I don't know about the textual user name, but if you are after the id -

Take a look at ShareKit's SHKFacebook class. It has an FBSession member called session. An FBSession has a FBUID which is just a typedef for long - but I'm assuming it represents some form of user ID.

christophercotton
  • 5,829
  • 2
  • 34
  • 49
Oded Ben Dov
  • 9,936
  • 6
  • 38
  • 53
1

you can get the ID's by extending the enum in sharetype . add type as ID . and when you can share function introduce the case for ID checking .

- (void)getFollowers
{
    OAMutableURLRequest *oRequest = [[OAMutableURLRequest alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://api.twitter.com/1/followers/ids.json?cursor=-1&screen_name=%@", SHKTwitterUsername]]
                                                                   consumer:consumer
                                                                      token:accessToken
                                                                      realm:nil   // our service provider doesn't specify a realm
                                                          signatureProvider:nil]; // use the default method, HMAC-SHA1

    [oRequest setHTTPMethod:@"GET"];

    //NSString *message=[NSString stringWithFormat:@"status=oh man! OAuth u almost killed me! more info at http://dev.twitter.com"];
    //[request setHTTPBody:[message dataUsingEncoding: NSUTF8StringEncoding]];

    OADataFetcher *fetcher = [[OADataFetcher alloc] init];
    //todo : handle for error callback
    [fetcher fetchDataWithRequest:oRequest
                         delegate:self
                didFinishSelector:@selector(getListsTokenTicket:didFinishWithData:)
                  didFailSelector:nil];

}
beryllium
  • 29,669
  • 15
  • 106
  • 125
1

you can get facebook user information using new facebook graph APIs for sample code you can use this.

0

If you need some user info, user name etc, this problem is solved in reborn ShareKit. See FAQ.

Vilém Kurz
  • 3,401
  • 2
  • 34
  • 43