5

I know how to create a "Follow me" button on Twitter, but I only want to display it if the user is not already following me. Is there a way to do this properly?

Jason
  • 14,517
  • 25
  • 92
  • 153

1 Answers1

0

You can get a list of your own followers' ids using this endpoint: https://dev.twitter.com/docs/api/1/get/followers/ids

If you know their twitter handle, you can get the id of someone using your app using this endpoint: https://dev.twitter.com/docs/api/1/get/users/lookup

Then your button display code will look something like:

if ([arrayOfFollowerIds containsObject:idOfAppUser]){

    followButton.hidden = YES;

}
Noah Dyer
  • 407
  • 5
  • 10